View previous topic :: View next topic
|
Author |
Message |
Jayalakshmi
New User
Joined: 02 Sep 2005 Posts: 26 Location: Hyderabad
|
|
|
|
Hi all,
I have a file (GDG) containing records like: (The file in real scenario will
have millions of records)
Hfilenamedate
D131434add1
D123434add2
T002
I would want to split this into two files and want the Header and
Trailer records in each of the splitted files. (Trailer needs the count generated)
File1:
Hfilenamedate
D131434add1
T001
File2:
Hfilenamedate
D123434add2
T001
Could anyone help me on this?
Thanks,
Jaya. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Please post your dcb info (dsorg/lrecl/etc) for both the input and output files.
Why is the trailer not the same in the output as the input (T002/T001)?
Will there be only one header and trailer in the input data?
Your sample has only 4 records and no "rules" on how to split them. Please post a bit more data (showing multiple headers/trailers if this may occur or clarifying that it may not) and more than just 2 data records. By chance id it the "add1" and "add2" that determines which output file the record should be placed in? Will all of the milliions of records have "addn" in them?
The more clear you present your requirement, the better/quicker responses you will receive. |
|
Back to top |
|
|
Jayalakshmi
New User
Joined: 02 Sep 2005 Posts: 26 Location: Hyderabad
|
|
|
|
The input file is a GDG like file.G0079V00
dsorg: sequential
rlecl: 336
27888.
I would want the two ouput files to be created as (+1) of input GDG
file.G0080V00
file.G0081V00
The input file will have a single header and trailer record. No multiple header n trailer records.
The Trailer record will have the count/number of detailed records in the file.
Hence, in a file if there are 2 D records then the trailer record will be T002
The Header, detail and trailer identified by H, D and T in the first position of each record.
There is no criteria for the split up. Just want the file to splitted into two (may not be exactly equal if the total number of D records are odd) with H and T records placed at the top and bottom of the splitted files as shown above.
The splitted file's trailer record should reflect the no. of D records in that file.
A input file with 1 H , 400 D, 1T (Trailer will be T400)
2 Output files with (1) -> 1H 200D, 1T (Trailer : T200)
and (2) -> 1H 200D, 1T (Trailer : T200)
Thanks again,
Jaya. |
|
Back to top |
|
|
Devzee
Active Member
Joined: 20 Jan 2007 Posts: 684 Location: Hollywood
|
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Jayalakshmi
Is the header copied as it is from the i/p file, or
It is dynamically decided based on the file name of the new version of file created and also clarify about the date filed in the header record. |
|
Back to top |
|
|
Jayalakshmi
New User
Joined: 02 Sep 2005 Posts: 26 Location: Hyderabad
|
|
|
|
The Header record just needs to be copied from the input file.
No significance here on date field
Thanks,
Jaya. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Jaya,
Here's a DFSORT job that will do what you asked for:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/336)
//OUT1 DD DSN=... output file1 (FB/336)
//OUT2 DD DSN=... output file2 (FB/336)
//SYSIN DD *
OPTION COPY
OMIT COND=(1,1,CH,EQ,C'T')
INREC OVERLAY=(337:SEQNUM,8,ZD,START=0,INCR=5)
OUTFIL FNAMES=OUT1,REMOVECC,
INCLUDE=(337,8,CH,EQ,C'00000000',OR,344,1,CH,EQ,C'5'),
BUILD=(1,336),
TRAILER1=(C'T',COUNT-1=(M11,LENGTH=3))
OUTFIL FNAMES=OUT2,REMOVECC,
INCLUDE=(344,1,CH,EQ,C'0'),
BUILD=(1,336),
TRAILER1=(C'T',COUNT-1=(M11,LENGTH=3))
/*
|
|
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Code: |
INREC OVERLAY=(337:SEQNUM,8,ZD,START=0,INCR=5)
|
This was a brilliant and simple trick frank.
Thanks for sharing with us |
|
Back to top |
|
|
Jayalakshmi
New User
Joined: 02 Sep 2005 Posts: 26 Location: Hyderabad
|
|
|
|
hi Frank,
Great Thanks!
I haven't worked much on DFSORT though my rusted brain
couldn't hit on such a trick. Many Thanks!
Jaya. |
|
Back to top |
|
|
ibmmainframesyntel
Active User
Joined: 26 Feb 2007 Posts: 126 Location: Chennai
|
|
|
|
Hi Jaya,
According to Frank's JCL,
If input file like this
Code: |
H1 E1 C 000000011E10800007030000000000219005165371000100001110800
F1 E1 C 000000011E10800007030000000000219005165371000100001110800
F2 E1 C 000000011E10800007030000000000219005165371000100001110800
F3 E1 C 000000011E10800007030000000000219005165371000100001110800
F4 E1 C 000000011E10800007030000000000219005165371000100001110800
F5 E1 C 000000011E10800007030000000000219005165371000100001110800
F6 E1 C 000000011E10800007030000000000219005165371000100001110800
T100000
|
O/P file will be
O/P file1
Code: |
H1 E1 C 000000011E10800007030000000000219005165371000100001110800
F1 E1 C 000000011E10800007030000000000219005165371000100001110800
F3 E1 C 000000011E10800007030000000000219005165371000100001110800
F5 E1 C 000000011E10800007030000000000219005165371000100001110800
T003
|
O/P file2
Code: |
H1 E1 C 000000011E10800007030000000000219005165371000100001110800
F2 E1 C 000000011E10800007030000000000219005165371000100001110800
F4 E1 C 000000011E10800007030000000000219005165371000100001110800
F6 E1 C 000000011E10800007030000000000219005165371000100001110800
T003
|
odd records and even records are splitted into seperate file.
is it Ok? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Well, yes, since it's what was asked for:
Quote: |
There is no criteria for the split up. Just want the file to splitted into two (may not be exactly equal if the total number of D records are odd) with H and T records placed at the top and bottom of the splitted files as shown above.
The splitted file's trailer record should reflect the no. of D records in that file. |
and apparently what was wanted:
Quote: |
Great Thanks!
I haven't worked much on DFSORT though my rusted brain
couldn't hit on such a trick. Many Thanks! |
|
|
Back to top |
|
|
|