Hi Bill,
Thanks a lot. I went per your instructions and coded it stepwise and pasting here the output of each and every step which i did.But i got bit confused while
Then do the PUSH of the blank key-line and the already PUSHed key.
.I got stuck over there from which position do we need to PUSH am sorry for troubling you a lot but nothing is coming. Please Kindly help me.
Pasted below are the code and its output at each step mentioned by you.
I suggest you "break it down". Do the sequence number addition first. Just that. SORTOUT to SYSOUT and look at what is produced.
Source Code:-
//STEP010 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SORTIN DD *
00001234 ERROR1 TYPE OF ERROR
00001234 ERROR ABOUT
00001234 TYPE2
ERROR FIELD
00001234 ERROR DESCRIPTION
00001234 DESC ENDED
00004567 ERROR2 TYPE OF ERROR
00004567 ERROR NAME
TYPE3
00004567 DESC ENDED
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL IFTHEN=(WHEN=INIT,BUILD=(1,60,SEQNUM,8,ZD,RESTART=(1,8)))
/*
Output:-
00001234 ERROR1 TYPE OF ERROR 00000001
00001234 ERROR ABOUT 00000002
00001234 TYPE2 00000003
ERROR FIELD 00000001
00001234 ERROR DESCRIPTION 00000001
00001234 DESC ENDED 00000002
00004567 ERROR2 TYPE OF ERROR 00000001
00004567 ERROR NAME 00000002
TYPE3 00000001
00004567 DESC ENDED 00000001
So, after the sequence number, change your WHEN=GROUP to PUSH after the current end of the record (after the sequence number). Run that. Look at and understand.
Source code:-
//STEP010 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SORTIN DD *
00001234 ERROR1 TYPE OF ERROR
00001234 ERROR ABOUT
00001234 TYPE2
ERROR FIELD
00001234 ERROR DESCRIPTION
00001234 DESC ENDED
00004567 ERROR2 TYPE OF ERROR
00004567 ERROR NAME
TYPE3
00004567 DESC ENDED
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL IFTHEN=(WHEN=INIT,BUILD=(1,60,SEQNUM,8,ZD,RESTART=(1,8))),
IFTHEN=(WHEN=GROUP,BEGIN=(61,8,CH,EQ,C'00000001'),PUSH=(71:1,8))
/*
Output:-
00001234 ERROR1 TYPE OF ERROR 00000001 00001234
00001234 ERROR ABOUT 00000002 00001234
00001234 TYPE2 00000003 00001234
ERROR FIELD 00000001
00001234 ERROR DESCRIPTION 00000001 00001234
00001234 DESC ENDED 00000002 00001234
00004567 ERROR2 TYPE OF ERROR 00000001 00004567
00004567 ERROR NAME 00000002 00004567
TYPE3 00000001
00004567 DESC ENDED 00000001 00004567
Then do the PUSH of the blank key-line and the already PUSHed key.
Then when you are happy with all that, you have to identify when you know you want to replace the space key. You check the key which has been pushed twice, against the key on the current record, and put that value in the blank on the PUSHED whole record.
Source code:-
//STEP010 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SORTIN DD *
00001234 ERROR1 TYPE OF ERROR
00001234 ERROR ABOUT
00001234 TYPE2
ERROR FIELD
00001234 ERROR DESCRIPTION
00001234 DESC ENDED
00004567 ERROR2 TYPE OF ERROR
00004567 ERROR NAME
TYPE3
00004567 DESC ENDED
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL IFTHEN=(WHEN=INIT,BUILD=(1,60,SEQNUM,8,ZD,RESTART=(1,8))),
IFTHEN=(WHEN=GROUP,BEGIN=(61,8,CH,EQ,C'00000001'),PUSH=(71:1,8)),
Output:-
00001234 ERROR1 TYPE OF ERROR 00000001 00001234
00001234 ERROR ABOUT 00000002 00001234
00001234 TYPE2 00000003 00001234
ERROR FIELD 00000001 ERROR FIELD
00001234 ERROR DESCRIPTION 00000001 ERROR FIELD
00001234 DESC ENDED 00000002 ERROR FIELD
00004567 ERROR2 TYPE OF ERROR 00000001 ERROR FIELD
00004567 ERROR NAME 00000002 ERROR FIELD
TYPE3 00000001 TYPE3
00004567 DESC ENDED 00000001 TYPE3
The above output which you look went out to the next line as the code tag accepts 80bytes
I am not sure if I have misunderstood completely . Please Kindly me help me out !!!!