View previous topic :: View next topic
Author
Message
sangiah New User Joined: 10 Jun 2005Posts: 62
I want to split a record based on a particluar field which occurs 120 times.
1 record to 120 records .
Back to top
Alain Benveniste New User Joined: 14 Feb 2005Posts: 88
sangiah,
Could you give me a concret example.
Alain
Back to top
sangiah New User Joined: 10 Jun 2005Posts: 62
FILE - A copy book (COBOL)
ORG PIC X(03).
ACCOUNT PIC X(19).
INTEREST PIC 9(07)V99 OCCURS 120 TIMES.
I need an output file looks like below
ORG ACCOUNT INTEREST(001)
ORG ACCOUNT INTEREST(002)
ORG ACCOUNT INTEREST(003)
ORG ACCOUNT INTEREST(004)
:
:
ORG ACCOUNT INTEREST(120)
Back to top
Alain Benveniste New User Joined: 14 Feb 2005Posts: 88
sangiah,
Assuming you want to cut your record by 25. But 25 is not a multiple of 120...
You will need to customize the OUTREC according to your need.
Code:
//STEP0001 EXEC PGM=ICETOOL
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN) USING(ICE0)
/*
//IN DD *
ORG ACCOUNT INTEREST(001)ORG ACCOUNT INTEREST(002)ORG ACCOUNT INTEREST(003)
/*
//OUTX DD SYSOUT=*
//ICE0CNTL DD *
OUTFIL FNAMES=OUTX,
OUTREC=(01,25,/,
26,25,/,
51,25)
/*
Does it answer to your need ?
Alain
Back to top
sangiah New User Joined: 10 Jun 2005Posts: 62
Alain,
Only interest is in multiples of 120 . example
My input will be like below
ORG ACCOUNT INTEREST(01) INTEREST(02) ...... INTEREST(120)
123 1234567890123456789 1234567.12 1234567.12 ..... 1234567.12
My output should be as below
ORG ACCOUNT INTEREST(01)
ORG ACCOUNT INTEREST(02)
:
:
ORG ACCOUNT INTEREST(120)
Thanks a lot alain
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
sangiah,
Here's a DFSORT job that will do what you want:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
OUTFIL OUTREC=(1,22,00023,10,/,
1,22,00033,10,/,
1,22,00043,10,/,
...
1,22,01203,10)
/*
However, it requires that you hardcode all 120 starting positions for INTEREST(1) to INTEREST(120).
Instead of doing that, you could generate the starting positions automatically using this DFSORT/ICETOOL job:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//ONE DD *
DUMMY
//IN DD DSN=... input file
//C1 DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(5,5)),DISP=(,PASS)
//OUT DD DSN=... output file
//TOOLIN DD *
COPY FROM(ONE) USING(CTL1)
COPY FROM(IN) USING(CTL2)
/*
//CTL1CNTL DD *
OUTFIL FNAMES=C1,REPEAT=118,
OUTREC=(13:C' 1,22,',SEQNUM,5,ZD,START=23,INCR=10,C',10,/,',80:X)
/*
//CTL2CNTL DD *
OPTION COPY
OUTFIL FNAMES=OUT,
OUTREC=(1,22,00023,10,/,
/*
// DD DSN=*.C1,VOL=REF=*.C1,DISP=(OLD,PASS)
// DD *
1,22,01203,10)
/*
Back to top
julienloc New User Joined: 17 Aug 2007Posts: 29 Location: Brussels
Hi,
I have a kind of similar problem, except that I don't know the occurence number of the repetitive field.
Here an example of my input file. It always contains only one record and LRECL is 80. 4033 is fixed, the other fields are of length=3 but I don't know how many times they occur (In this case occurence number=4):
4033 002 004 006 010
What I would like to have as output is:
4033 002
4033 004
4033 006
4033 010
As a solution, I was thinking of declaring the REPEAT for the maximum of times the field could be repeated in a LRECL of 80. The first step would then have in our example a result of:
4033 002
4033 004
4033 006
4033 010
4033
......
4033
4033 <--Line (80-5)div4
And then add a filter step that would remove the lines which do not have data on position 6, so it would keep only the first 4 lines in this example.
Any better idea?
Thanks.
Julien
Back to top
Please enable JavaScript!