Page 1 of 1

Assign same sequence number for set of records.

PostPosted: Thu Jul 30, 2009 5:36 pm
by ranga_subham
Hi,

My input file (LRECL=80, RECFM=FB) contains sets of records and I need to assign 6 digit sequence number for each set of records. Each set of records start with '01' and ends with '99' type in column 1 (2 byte field). Each set of record can be distinguished by looking at column 6 (10 bytes length) of input record. The output file should be LRECL=80 and RECFM=FB. We are using "SYNCSORT FOR Z/OS 1.2.3.1R".

Input:
----+----+----+----+
01755    BZX755
02755    BZX755
06755    BZX755
06755    BZX755
06755    BZX755
06755    BZX755
07755    BZX755
08755    BZX755
09755    BZX755
99755    BZX755
01756    BZY756
02756    BZY756
06756    BZY756
06756    BZY756
06756    BZY756
06756    BZY756
07756    BZY756
08756    BZY756
09756    BZY756
99756    BZY756
01757    BZA757
02757    BZA757
06757    BZA757
06757    BZA757
06757    BZA757
06757    BZA757
07757    BZA757
08757    BZA757
09757    BZA757
99757    BZA757


Desired output:
----+----+----+----+----+----+
00000101755    BZX755
00000102755    BZX755
00000106755    BZX755
00000106755    BZX755
00000106755    BZX755
00000106755    BZX755
00000107755    BZX755
00000108755    BZX755
00000109755    BZX755
00000199755    BZX755
00000201756    BZY756
00000202756    BZY756
00000206756    BZY756
00000206756    BZY756
00000206756    BZY756
00000206756    BZY756
00000207756    BZY756
00000208756    BZY756
00000209756    BZY756
00000299756    BZY756
00000301757    BZA757
00000302757    BZA757
00000306757    BZA757
00000306757    BZA757
00000306757    BZA757
00000306757    BZA757
00000307757    BZA757
00000308757    BZA757
00000309757    BZA757
00000399757    BZA757


Please help.

Thanks.

Re: Assign same sequence number for set of records.

PostPosted: Thu Aug 06, 2009 5:01 am
by arcvns
Hello,

This is untested. But you can give this a try. I have assumed an output LRECL of 86.

//STEP1  EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD DSN= Input  file (FB/80)                           
//SORTOUT  DD DSN= Output file (FB/86)
//SYSIN    DD *                                                     
  OPTION COPY                                                       
  INREC IFTHEN=(WHEN=INIT,BUILD=(SEQNUM,6,ZD,1,80)),                 
        IFTHEN=(WHEN=(7,2,CH,EQ,C'01'),                             
        OVERLAY=(1:SEQNUM,6,ZD)),                                   
        IFTHEN=(WHEN=NONE,                                           
        OVERLAY=(87:SEQNUM,6,ZD,01:01,6,ZD,SUB,87,6,ZD,M11,LENGTH=6))
  OUTREC BUILD=(1,86)

Re: Assign same sequence number for set of records.

PostPosted: Thu Aug 06, 2009 3:27 pm
by ranga_subham
Thank you.....I will try it.

Re: Assign same sequence number for set of records.

PostPosted: Fri Aug 07, 2009 10:48 am
by arcvns
You're welcome. Good luck.