ibm-midrangerpglerpg

Convert a DS from fixed to free form in RPGLE


I have the following data structure in an old program

D P1PARM DS 256
D P1ADFR 1 15
D P1ADTO 16 30
D P1MSNR 31 37 0
D P1NSNR 38 44 0
D P1YEAR 45 48 0
D P1COMP 59 62
D P1FAC 63 67
D P1PPSR 68 74 0
D P1PTNS 75 79

I want to use this in a new program but want to convert this into free format , can someone help me with the syntax. I have searched the net but could find an example for this kind of position based data structure which is overlaying over the main size of 256.

Thanks in advance.


Solution

  •    Dcl-DS P1PARM Len(256);
         P1ADFR         Char(15)   Pos(1);
         P1ADTO         Char(15)   Pos(16);
         P1MSNR         Zoned(7:0) Pos(31);
         P1NSNR         Zoned(7:0) Pos(38);
         P1YEAR         Zoned(4:0) Pos(45);
         P1COMP         Char(4)    Pos(59);
         P1FAC          Char(5)    Pos(63);
         P1PPSR         Zoned(7:0) Pos(68);
         P1PTNS         Char(5)    Pos(75);
        End-DS;