View previous topic :: View next topic
Author
Message
Deepa Natarajan New User Joined: 06 Jan 2008Posts: 11 Location: India
Hi..
My input file is of Lrecl 11 and its in the below format:
My key field is 1-9 bytes.
111111111__
111111111__
111111111CR
111111112HR
111111112CR
111111112BR
111111113__
111111113__
111111113__
My output file should be lik the below:
111111111CR
111111112HR
111111112CAR
111111112BAR
111111113__
if Pos10-11 is having values (for the same key) i should write that to the output file (See: 111111112). If Pos10-11 is having all blanks then output only one key with a blank (see:111111113) if pos10-11 is having spaces as well as values, then output the key only with the values (See:111111111)
Can someone help me in this?
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Where did the CAR and BAR output records come from? They aren't in the input file (the input file does have CR and BR records).
What is the RECFM and LRECL of the input file?
Quote:
if pos10-11 is having spaces as well as values, then output the key only with the values (See:111111111)
Can you have input records like this:
111111114__
111111114__
111111114CR
111111114CR
111111114HR
If so, what would you expect as output for these input records?
If there are blank records, are they always before the non-blank records, or can the blank records be anywhere? For example, would this be possible:
111111115__
111111115HR
111111115__
Back to top
Deepa Natarajan New User Joined: 06 Jan 2008Posts: 11 Location: India
Sorry for d typo!
there is no CAR and BAR records. tat shud be CR and BR only.
if my input file is like below:
111111114__
111111114__
111111114CR
111111114CR
111111114HR
My output shud be:
111111114CR
111111114CR
111111114HR
if there r blank values and a value, remove the blank values.
Yes, the blank records can occur anywhere.
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Here's a DFSORT/ICETOOL job that will do what you asked for based on the examples you gave and your explanations:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (FB/11)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=... output file (FB/11)
//TOOLIN DD *
SORT FROM(IN) USING(CTL1)
SORT FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
INREC OVERLAY=(12:SEQNUM,8,ZD)
SORT FIELDS=(1,9,CH,A,10,2,CH,D)
OUTREC OVERLAY=(20:SEQNUM,8,ZD,RESTART=(1,9))
OUTFIL FNAMES=T1,OMIT=(10,2,CH,EQ,C' ',AND,20,8,ZD,GT,1)
/*
//CTL2CNTL DD *
SORT FIELDS=(12,8,ZD,A)
OUTREC BUILD=(1,11)
/*
I used these input records for SORTIN:
Code:
111111111
111111111
111111111CR
111111112HR
111111112CR
111111112BR
111111113
111111113
111111113
111111114
111111114
111111114CR
111111114CR
111111114HR
111111115
111111115HR
111111115
and got these output records for SORTOUT:
Code:
111111111CR
111111112HR
111111112CR
111111112BR
111111113
111111114CR
111111114CR
111111114HR
111111115HR
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
Deepa Natarajan,
Here is another way of doing it
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Your 11 byte FB input file,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,BUILD=(1,11,C'0')),
IFTHEN=(WHEN=(10,2,CH,EQ,C' '),OVERLAY=(12:C'1'))
SORT FIELDS=(1,9,CH,A,12,1,CH,A),EQUALS
OUTREC OVERLAY=(13:SEQNUM,8,ZD,RESTART=(1,9))
OUTFIL OMIT=(12,1,ZD,EQ,1,AND,13,8,ZD,GT,1),BUILD=(1,11)
//*
Back to top
Deepa Natarajan New User Joined: 06 Jan 2008Posts: 11 Location: India
Thanks for your help, franker n kolusu!
Back to top
Please enable JavaScript!