In my mind there was something "parse the record and find the fields".
So, starting from this input: *F00:FIELD00*F01:FIELD01*F02:FIELD02* *F01:FIELD01*F00:FIELD00*F02:FIELD02* *F02:FIELD02*F00:FIELD00*F01:FIELD01* *F00:FIELD00*F02:FIELD02* *F00:FIELD00*F02:FIELD02*F01:FIELD01* *F02:FIELD02*F01:FIELD01* I'm expecting: F00=FIELD00 -F01=FIELD01 -F02=FIELD02 - F00=FIELD00 -F01=FIELD01 -F02=FIELD02 - F00=FIELD00 -F01=FIELD01 -F02=FIELD02 - F00=FIELD00 -F01= -F02=FIELD02 - F00=FIELD00 -F01=FIELD01 -F02=FIELD02 - F00= -F01=FIELD01 -F02=FIELD02 - because at record n.4 F00 and F02 are present and at record n. 5 both F01 and F02 are present. Hope it's clear now. Thanks a lot. Massimo 2016-05-27 17:30 GMT+02:00 Sri h Kolusu <[email protected]>: > Massimo, > > It is not clear as to what you are trying to do. Can you please show us > the desired output from the sample you have given? Also please tell us > about the DCB properties of the input and output datasets. > > Thanks, > Sri Hari Kolusu > DFSORT Development > IBM Corporation > > > > From: Massimo Biancucci <[email protected]> > To: [email protected] > Date: 05/27/2016 05:36 AM > Subject: Sort PARSE, ABSPOS and SUBPOS. How to PARSE when one or > more fields are missed. > Sent by: IBM Mainframe Discussion List <[email protected]> > > > > Hi everybody, > > I'm trying to parse a variable record where some fields can and cannot be > present. > > It seems, after the first search failure (pointer hit the end of record) > there's no chance to restart the parsing from the beginning. > > This is a test: > > //SORTIN DD * > *F00:FIELD00*F01:FIELD01*F02:FIELD02* > *F01:FIELD01*F00:FIELD00*F02:FIELD02* > *F02:FIELD02*F00:FIELD00*F01:FIELD01* > *F00:FIELD00*F02:FIELD02* > *F00:FIELD00*F02:FIELD02*F01:FIELD01* > *F02:FIELD02*F01:FIELD01* > /* > //SORTOUT DD SYSOUT=* > //SYSIN DD * > INREC PARSE=(%00=(STARTAFT=C'F00:', > ENDBEFR=C'*', > FIXLEN=15), > %=(ABSPOS=1,FIXLEN=1), > %01=(SUBPOS=1000,STARTAFT=C'F01:', > ENDBEFR=C'*', > FIXLEN=15), > %=(ABSPOS=1,FIXLEN=1), > %02=(STARTAFT=C'F02:', > ENDBEFR=C'*', > FIXLEN=15)), > BUILD=(C'F00=',%00,C'-F01=',%01,C'-F02=',%02,C'-') > SORT FIELDS=COPY > /* > > The output is: > > F00=FIELD00 -F01=FIELD01 -F02=FIELD02 - > > F00=FIELD00 -F01=FIELD01 -F02=FIELD02 - > > F00=FIELD00 -F01=FIELD01 -F02=FIELD02 - > > F00=FIELD00 -F01= -F02= - > > F00=FIELD00 -F01=FIELD01 -F02=FIELD02 - > > F00= -F01= -F02= - > > > I tried with: > > //SYSIN DD * > INREC PARSE=(%00=(STARTAFT=C'F00:', > ENDBEFR=C'*', > FIXLEN=15), > %01=(SUBPOS=1000,STARTAFT=C'F01:', > ENDBEFR=C'*', > FIXLEN=15), > %02=(SUBPOS=1000,STARTAFT=C'F02:', > ENDBEFR=C'*', > FIXLEN=15)), > BUILD=(C'F00=',%00,C'-F01=',%01,C'-F02=',%02,C'-') > SORT FIELDS=COPY > /* > > too with no difference. > > The behaviour is the same for DFSort and SyncSort. > > This does lead me to think I didn't fully understand the following manual > statement (from DFSort): > > "*ABSPOS=p* > Sets the Start Pointer for this parsed field to p. p can be 1 to 32752. By > default, the Start Pointer for the first %nn parsed field is position 1 > for > fixed-length records or position 5 for variable-length records, and the > Start > Pointer for each subsequent %nn parsed field is the Start Pointer set by > the > previous %nn field. You can use ABSPOS=p to set the Start Pointer to > position p to override the default Start Pointer. If the resulting Start > Pointer > is less than position 5 for variable length records, it will be set to > position > 5." > > and > > " *SUBPOS=y* > Decrements the Start Pointer for this parsed field by y. y can be 1 to > 32752. > By default, the Start Pointer for the first %nn parsed field is position 1 > for > fixed-length records or position 5 for variable-length records, and the > Start > Pointer for each subsequent %nn parsed field is the Start Pointer set by > the > previous %nn field. You can use SUBPOS=y to decrement the Start Pointer > by x to override the default Start Pointer. If the resulting Start Pointer > is > less than position 1 for fixed-length records, it will be set to position > 1. If > the resulting Start Pointer is less than position 5 for variable-length > records, it will be set to position 5." > > Thanks a lot for your support. > Massimo > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > > > > > > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
