I wish to do the following , I have a transaction file which is having very high volume.The file attributes of the input file are mentioned below :-
1) Fixed length (100Bytes)
2) File structure are as follows
Code:
HEADER RECORD
DETAIL RECORD 1
DETAIL RECORD 2
DETAIL RECORD 3
DETAIL RECORD 4
12345678B123456789123456789123456789123456789123456789123456789123456789123BCH0000001
DETAIL RECORD 5
DETAIL RECORD 6
12345678B123456789123456789123456789123456789123456789123456789123456789123BCH0000002
DETAIL RECORD 7
DETAIL RECORD 8
DETAIL RECORD 9
DETAIL RECORD 10
12345678B123456789123456789123456789123456789123456789123456789123456789123BCH0000001
FILE TRAILER
Batch can be identifiied only (if ninth character of the file is = 'B' and starting from 76 position(Upto 3 Bytes) is equal to BCH).Starting from 79 to 85 (7 Bytes) is the batch number.
All the transactions coming before that batch trailer belongs to that batch.So in current situation there are two batch(BCH0000001 have repeated again)
Batches are :-
BCH0000001
BCH0000002
Now let us come to the requirement .
Depending on the number of batches i have to create output files DYNAMICALLY.For the above sample data i have to create two output files.The attributes of the output file will be same as of the input file.
Naming convention of the output file created should contain batch information(Batch identifier + Batc sequence number) .e.g FILE.BCH0000001 & FILE.BCH0000002
All the data which are present on top of the Batch trailer belongs to that batch.I have to split the file on per batch basis.My output files should contain as follows
FILE.BCH0000001 should contain ==>
Code:
DETAIL RECORD 1
DETAIL RECORD 2
DETAIL RECORD 3
DETAIL RECORD 4
DETAIL RECORD 7
DETAIL RECORD 8
DETAIL RECORD 9
DETAIL RECORD 10
FILE.BCH0000002 should contain ==>
Code:
DETAIL RECORD 5
DETAIL RECORD 6
Please let me know in case i have missed some thing.
Cheers
As its a transaction file there is not limit of the batches.
Regards
I am asking about unique count of batch numbers..
If there is no maximum limit for that..
Basic truth you need to understand about JCL: You can not dynamically decide number of datasets to be allocated in JCL once it is submitted.
I think, You might have to look back at your design.
Unique count batch number will present in all the files .If it helps I can make change in the design that there will be one more input file(FILE1) which will contain the Batch trailer information.So if there are 2 batch entry in the FILE1.Two output files (same attribute as of transaction file and having batch trailer information in the DSN) will be created and if corresponding batch trailer found in the transaction file all record above the batch trailer need to be extracted to the new output file created. Here is the example.
Input file 1(RL=40)
Record Present in the this file
Code:
BCH0000001
BCH0000003
Input file2(RL=100)
Record Present in the this file
Code:
HEADER RHCORD
DETAIL RECORD 1
DETAIL RECORD 2
DETAIL RECORD 3
DETAIL RECORD 4
12345678B123456789123456789123456789123456789123456789123456789123456789123BCH0000001
DETAIL RECORD 5
DETAIL RECORD 6
12345678B123456789123456789123456789123456789123456789123456789123456789123BCH0000002
DETAIL RECORD 7
DETAIL RECORD 8
DETAIL RECORD 9
DETAIL RECORD 10
12345678B123456789123456789123456789123456789123456789123456789123456789123BCH0000001
DETAIL RECORD 11
DETAIL RECORD 12
DETAIL RECORD 13
DETAIL RECORD 14
12345678B123456789123456789123456789123456789123456789123456789123456789123BCH0000003
FILE TRATLER
There will be two output file which will have same attribute as of file2
FILE.BCH0000001 should contain ==>
Code:
DETAIL RECORD 1
DETAIL RECORD 2
DETAIL RECORD 3
DETAIL RECORD 4
DETAIL RECORD 7
DETAIL RECORD 8
DETAIL RECORD 9
DETAIL RECORD 10
FILE.BCH0000003 should contain ==>
Code:
DETAIL RECORD 11
DETAIL RECORD 12
DETAIL RECORD 13
DETAIL RECORD 14
Note - As BCH0000002 is not present in File1 . This need to be skipped.
Hope this make sense
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
Quote:
Naming convention of the output file created should contain batch information(Batch identifier + Batc sequence number) .e.g FILE.BCH0000001 & FILE.BCH0000002
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
shr_amar,
Use the following DFSORT JCL . This job will read in your 40 byte file and create dynamic split control cards and submit the job to intrdr. Verify the output from step0200 in the below JCL and once everything looks like ok change the following statement in STEP0200
There is further enhancement required in the code .Which is as follows :-
Currently we extracted all the records which are coming before a specified trailer present in 40 bytes input file BCH0000001 & BCH0000003
Now i have to extract records which are coming before batch trailer and a dynamic value(fixed length =7 bytes),(Let us call it a tran-id) present at 20th position.
Single trailer value can have different tran-id and i have modifiy input 40 byte file to replicate which trailer is asscociated with tran-id.
Tried to modify the exixting code which work for one trailer - one tran-id combination .
Don't know how a multiple occurance can be handle in dfsort.
There is no limit of duplicates . As one batch trailer can have n numbers of tran - id . But if there is restriction of the duplicated and you understand the whole idea we can modify the 40 byte input file . For e.g
we can have two input file which are as follows
File 1 ( 40 bytes )
Code:
BCH0000001 2
BCH0000003 3
File 2 (FB 10 bytes)
Code:
5555555
6666666
4444444
8888888
7777777
This means BCH0000001 will have first 2 tran-id from second file and
BCH0000003 will have next 3 tran id .
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
shr_amar wrote:
There is no limit of duplicates . As one batch trailer can have n numbers of tran - id . But if there is restriction of the duplicated and you understand the whole idea we can modify the 40 byte input file
shr_amar,
You ought to have a limit or else it is difficult to generate the include conditions. It would be an OK job if the generated include conditions are only dealing with 1 or 2 variables , but it gets complicated if the number varies. Time to sit down and write a program
Let us try to fix it and go to your previous question :-
Quote:
What is the max num of dups you can have on the 10 byte key? i.e BCH0000001 is repeated twice and BCH0000003 is also repeated twice.
I have flexibilty to split the file based on Tran-ID.As I can set maximum 5 tran-id per trailer in a file there will be maximum 5 duplicates.Can this be achieve?
Once i am ready with DFSORT for 5 duplicates, I will roll out to other TRAN_ID.