mainframe - Need to compare the same field in different records with JCL SORT -


i have input file, 3rd field in file number. number repeated in same field 30-40 records, when record read has different value in field need number '1' print in first position of following record. e.g.

           7226184019519       317786762  0000000000001pop160            7226184019522       317786762  0000000000001pop160 1          7226139045234       326446460  0000000000001pop160            7226139045242       326446460  0000000000001pop160            7226139045274       326446460  0000000000001pop160            7226139045277       326446460  0000000000001pop160            7226139045280       326446460  0000000000001pop160 

i've tried using 'sections' like:

sort fields=copy    outfil fnames=sortout,    sections=(26,9,header3= (1:'1'))   

but print number '1' on separate line:

           7226184019519       317786762  0000000000001pop160            7226184019522       317786762  0000000000001pop160 1                      7226139045234       326446460  0000000000001pop160            7226139045242       326446460  0000000000001pop160            7226139045274       326446460  0000000000001pop160            7226139045277       326446460  0000000000001pop160            7226139045280       326446460  0000000000001pop160 

i need overlay i'm not sure how use 'sections'.
note: number above, 317786762 starts in position 26.


amendment

i've figured out how move 1 first position(code below). requirement complete sort '1' printed in position 1 after every 30 records or when number in pos 26,9 changes.

//sysin     dd *    sort fields=copy     inrec ifthen=(when=init,overlay=(101:seqnum,8,zd,        restart=(26,9))),        ifthen=(when=(101,8,zd,eq,30),        overlay=(1:c'1')) /* 

this code sets sequence number in pos 101,8. restarts seqnum when there's new value in 26,9. need sequence number restart when value of seqnum 30. far know restart works if value of field changes. can't use logical expressions it.

so question is, know way write sort read sequential file , print '1' in position 1 after every 30 records or after new value found in field.

i'm guessing records fixed-length.

use inrec ifthen=(when=init... temporarily extend records include sequence number. sequence number needs large enough cover maximum number of records in group (and make power of 10 larger). use restart= on sequence number, , specify key field there.

then, in of recent questions, use ifthen=(when=(logicalexpression identify first of group (sequence one) , overlay c'1' @ column one.

use ifoutlen= original record-length, return records original size. ifoutlen says "after completion of ifthen processing, set record-length this". saves having build drop off temporary extension.

procedure different (extend @ first data-position, 5, , must have build return size) variable-length records.


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -