View previous topic :: View next topic
Author
Message
Ambili S Active User Joined: 06 Sep 2007Posts: 112 Location: India
Hi
I have an input file with character and numeric data.
I/p:
AAA
BBB
CCC
111
222
333
The o/p should be :
AAA111
BBB222
CCC333
i.e. the corresponding alphabet and numeric data should appear together in the output file.
Please let me know how to do this using DFSORT.
Back to top
smijoss Active User Joined: 30 Aug 2007Posts: 114 Location: pune
how many such alphabetic sequence are u expecting ,
are all the non numeric data grouped together
can the data be like
AAA
CCC
BBB
111
222
333
in such a case wat wud be ur o/p
Back to top
Ambili S Active User Joined: 06 Sep 2007Posts: 112 Location: India
yes the data can be as u mentioned . The o/p should be like , the 1st Alphabet should be combined with 1st Numeric data , 2nd alphabet with 2nd numeric and so on. And for any alphabet there's no corresponding numeric then it should appear as it is.
Back to top
smijoss Active User Joined: 30 Aug 2007Posts: 114 Location: pune
Code:
//S1 EXEC PGM=ICETOOL
//FILE1 DD *
AAA
BBB
CCC
111
222
333
//FILEOUT DD DSN=TEMP.TLM.TEST.DEL3,
// DISP=(NEW,CATLG),UNIT=DISK,
// SPACE=(27998,(400,100),RLSE)
//TEMP DD SPACE=(27998,(400,100),RLSE),
// DISP=(,PASS),UNIT=DISK
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TOOLIN DD *
COPY FROM(FILE1) TO(TEMP) USING(CTL1)
SPLICE FROM(TEMP) TO(FILEOUT) ON(30,2,CH) WITH(4,3) -
WITHANY USING(CTL2)
/*
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=(1,3,ZD,NE,NUM),OVERLAY=(30:SEQNUM,2,ZD)),
IFTHEN=(WHEN=(1,3,ZD,EQ,NUM),OVERLAY=(4:1,3,1:3X,30:SEQNUM,2,ZD))
//CTL2CNTL DD *
OUTFIL BUILD=(1,29)
Back to top
sqlcode1 Active Member Joined: 08 Apr 2010Posts: 577 Location: USA
Ambili S,
Here is the single pass method with similar logic. I am assuming 80 byte input file.
Code:
//STEP01 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
AAA
BBB
CCC
111
222
333
444
//OUT DD SYSOUT=*
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(81,2,CH) WITHANY KEEPNODUPS -
WITH(4,3) USING(CTL1)
/*
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=(1,3,ZD,NE,NUM),OVERLAY=(81:SEQNUM,2,ZD)),
IFTHEN=(WHEN=NONE,OVERLAY=(4:1,3,1:3X,81:SEQNUM,2,ZD))
OUTFIL BUILD=(1,80)
/*
OUTPUT
Code:
AAA111
BBB222
CCC333
444
Thanks,
Back to top
Please enable JavaScript!