View previous topic :: View next topic
Author
Message
wanderer Active User Joined: 05 Feb 2007Posts: 199 Location: Sri Lanka
Hi,
I have a file(FBA 133) that looks like this.
Code:
DATA aaaa.aaaaa.aaaa.aaaa
TYPE=x1
NUM=bbbb.bbbb
DATA aaaa.aaaaa.aaaa.bbbb
TYPE=x2
NUM=bbbb.cccc
I want the output to look like
Code:
aaaa.aaaa.aaaa.aaaa x1 bbbb.bbbb
aaaa.aaaa.aaaa.bbbb x2 bbbb.cccc
Basically, it groups three rows into 1 row and does some editing like removing 'data/type/num' from the output.
thanks for any help!
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Am I correct that 'DATA' starts in position 2 (after the ANSI carriage control character), 'TYPE' starts in position 7 and NUM starts in position 13?
What do you want for the RECFM and LRECL of the output file?
Back to top
wanderer Active User Joined: 05 Feb 2007Posts: 199 Location: Sri Lanka
Frank,
Yes, DATA starts in position 2(after ANSI CC caracter). And TYPE, NUM start at 7 and 13 respectively.
LRECL of 80 and RECFM of FB would be great.
Thanks!
Back to top
wanderer Active User Joined: 05 Feb 2007Posts: 199 Location: Sri Lanka
Frank,
The input file is actually VBA with LRECL 133
Sorry for the confusion.
Thanks!
Back to top
dineshness New User Joined: 25 Dec 2006Posts: 63 Location: Perambalur
You could use the below ICETOOL job to sort the records,
[img]//STEP1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//INFILE DD DSN=INPUT FILE 1(VBA File/133)
//TEMP DD DSN = TEMP FILE(FB file/80)
//OUTF DD DSN = OUT FILE 1(FB file/80)
//TOOLIN DD *
COPY FROM INFILE USING CTL1
SPLICE FROM TEMP ON (34,8,ZD) WITHEACH USING CTL2
//CTL1CNTL DD *
*Reformat the records and add sequence numbers
OUTFIL FNAMES=TEMP,
IFTHEN=(WHEN=(6,4,CH,EQ,C'DATA'), BUILD =(1:11,19,34:SEQNUM,8,ZD))
IFTHEN=(WHEN=(10,5,CH,EQ,C'TYPE='), BUILD =(21:15,2,34:SEQNUM,8,ZD))
IFTHEN=(WHEN=(16,4,CH,EQ,C'NUM='), BUILD =(24:20,9,34:SEQNUM,8,ZD))
/*
//CTL2CNTL DD *
OUTFIL FNAMES = OUTF, BUILD = (1,32)
/*[/img]
Quote:
DATA aaaa.aaaaa.aaaa.aaaa
DATA aaaa.aaaaa.aaaa.bbbb
I assumed that the "aaaaa" after the first dot is mistaken for "aaaa".
Dinesh.
Back to top
wanderer Active User Joined: 05 Feb 2007Posts: 199 Location: Sri Lanka
Dinesh,
yes, 'aaaaa' was a typo.
I get a SYNTAX error with '$' under IFTHEN and BUILD. I suppose I don't have the appropriate PTFs installed. And so out of luck!
Thanks anyway for your effort.
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
wanderer,
Dinesh had the right idea, but the job he supplied has many errors and won't run. Here's a DFSORT/ICETOOL job that will do what you asked for:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (VBA)
//OUT DD DSN=... output file (FB/80)
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(41,8,ZD) -
WITHEACH WITH(26,2) WITH(29,9) USING(CTL1)
/*
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=(6,4,CH,EQ,C'DATA'),
BUILD=(1:1,4,5:11,20,41:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(11,5,CH,EQ,C'TYPE='),
BUILD=(1,4,26:16,2,41:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(17,4,CH,EQ,C'NUM='),
BUILD=(1,4,29:21,9,41:SEQNUM,8,ZD))
OUTFIL FNAMES=OUT,VTOF,
BUILD=(5,33,80:X)
/*
Back to top
wanderer Active User Joined: 05 Feb 2007Posts: 199 Location: Sri Lanka
Frank,
I keep getting
ICE005A 0 STATEMENT DEFINER ERROR
for IFTHEN and BUILD. I suppose I don't have proper PTF installed and out of luck!
Thanks for the help!
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Do you have at least one space before each line in CTL1CNTL? If not, add the spaces. If you get the ICE005A with the spaces, then your site is way behind on DFSORT service; IFTHEN and BUILD have been available since Dec, 2004. Ask your System Programmer to z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006). That will get you all of the latest DFSORT/ICETOOL functions.
Back to top
wanderer Active User Joined: 05 Feb 2007Posts: 199 Location: Sri Lanka
Frank,
No I did not have one space on one line. Now it is working fine. Thanks very much!
I have another problem though. Sometimes the file contains other records in the file that are smaller than these records. I need to ignore these extra records if they come in between.
For example,
There is a record with just a carriage control character but no data following it. This should be ignored.
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
You can use an OMIT statement to remove those records. You'd have to show me what those records look like in hex for me to give you the OMIT condition. You can use this DFSORT job to display the records in hex:
Code:
//SHOWV EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTREC FIELDS=(1,4,1,4,HEX,5,HEX)
/*
Back to top
wanderer Active User Joined: 05 Feb 2007Posts: 199 Location: Sri Lanka
Frank,
OMIT worked. Although records sizes and positions have changed since then, I was able to use your original code and modify it appropriately.
Thanks a lot!
Back to top
Please enable JavaScript!