|
View previous topic :: View next topic
|
| Author |
Message |
Subhasish Sarkar
New User
Joined: 21 Oct 2011 Posts: 16 Location: India
|
|
|
|
Hi,
I have an Input File, say, FILE A, (LRECL=80 and RECFM=FB) which contains BLOCKS OF RECORDS. A Particular BLOCK OF RECORD would have 11 Records.
I am having another Input File, say, FILE B (LRECL=80 and RECFM=FB). This Input FILE B also contains BLOCKS OF RECORDS, each BLOCK OF RECORD again consisting of 11 Records. The structure of the BLOCKS OF RECORDS in both the Input FILE A and FILE B is exactly the same.
NOTE: - The Input File B would have much more number of BLOCKS OF RECORDS than the Input FILE A.
| Code: |
AAP11003029M-[b]MPSMAS614EDDFWMKK0411111413TO1827271361[/b] 9
8207 702729220727485---+++7290651521136913201921 211
081261333635300)011377497000000000000000027A0827A0827A
631452037459311619291 117 171505 63431360150112 239242
22///11 145519070299 1656532 344441348 908 939 7986 66
14499 64081370030004 36262 99 74 857 488 0100004
2 334431348 909 934 8077 66514527:::::312319318 178:::
98 88 846 501 41000044///10 145519070299 1656533
81451637004313319359 170 115494 63501360040004 173254
2///11 145519070299 1656519 48493143814401439143915181
9
|
(1) I am reading column 14 to 52 of the 1st record of the last BLOCK OF RECORD present in the Input FILE A, as highlighted in BOLD above.
(2) I have to scan through the Input FILE B sequentially from the Top and whenever I encounter the last BLOCK OF RECORD present in the 1st Input FILE A,
I need to write out all subsequent BLOCKS OF RECORDS from the Input FILE B to an Output File, say, FILE C.
How could this be acheived through DFSORT? |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
And what have you tried? You've had solutions for three different "block" requirements, can't you even make an attempt at it yourself?
Also, re-read your post. It is entirely unclear either what your "column" is, or what you want to do with it. |
|
| Back to top |
|
 |
Subhasish Sarkar
New User
Joined: 21 Oct 2011 Posts: 16 Location: India
|
|
|
|
Basically, the idea is to write to an Output FILE C, only those BLOCKS OF RECORDS from the Input FILE B which appear below the last BLOCK OF RECORD present in the Input File A.
The last BLOCK OF RECORD present in the Input FILE A is also present somewhere in the Input FILE B and all those BLOCKS OF RECORDS in the Input FILE B that appear below this last BLOCK OF RECORD from the Input File A should get written into the Output File.
Note that the sequence of Records in either of the two Input Files cannot be changed.
And, the unique key to identify an entire BLOCK OF RECORD is column 14 to 52 of the 1st record of each BLOCK OF RECORD (consisting of a total of 11 records).
Do let me know if the information provided is still unclear. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Let's see if I got it.
You have a "key" which is at a particular position on the first record of a block. The key is unique within file A and file B.
You have to take the key of the last record of file A, find that key in the correct position on file B and then write everything after that block to file C.
In which case, you can make the temporary records for file A, as previously shown, obtain the last record from that file, extract the key, generate a symname with that value, to feed into the next step which makes the temporary records for file B then only starts the copy once the key on the symname is reached, from which point you do the chopping-up of the temporary record back to its original 11 constituents.
You could just zip through file B without making the temporary file, but you'd run the risk of finding the "key" in some other place than the first record of a block. It is a highly unlikely situation, which means it'll happen on the second production run if you don't deal with it correctly.
Obviously this is not a solution, but an outline of a solution. You could have a crack at it yourself, or just sit around and wait. |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
|
|
| Quote: |
| A typical BLOCKS OF RECORDS Selection Criterion. |
nothing typical ...
just a confusing description of a more confusing requirement  |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Four "blocks" topics in 15 days. I suppose it might seem "typical" to TS. Also typical is quality of information.
Having received several "blocks" solutions already, I'm keen to see what has been usefully absorbed, rather than dribbled down the chin :-) |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
Subhasish Sarkar,
| Quote: |
(1) I am reading column 14 to 52 of the 1st record of the last BLOCK OF RECORD present in the Input FILE A, as highlighted in BOLD above.
(2) I have to scan through the Input FILE B sequentially from the Top and whenever I encounter the last BLOCK OF RECORD present in the 1st Input FILE A,
I need to write out all subsequent BLOCKS OF RECORDS from the Input FILE B to an Output File, say, FILE C. |
Please provide better example of your sample input data and expected output. Try to cover all the possible scenarios. What do you mean by all the subsequent blocks of records. Did you mean until End Of File?
Thanks, |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Subhasish Sarkar,
If I understand correctly what you want to do, you can use a DFSORT/ICETOOL job like the following. STEP1 sets up a symbol for your key from the last block of file1. STEP2 adds group ids and sequence numbers to the blocks in file2 and sets up a symbol for the target id (group id that has your key). STEP3 writes all of the records from file2 with group ids greater than the target id to the output file.
| Code: |
//STEP1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/80)
//S1 DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//TOOLIN DD *
SUBSET FROM(IN1) TO(S1) INPUT KEEP LAST(11) USING(CTL1)
//CTL1CNTL DD *
OUTFIL FNAMES=S1,ENDREC=1,
BUILD=(C'TARGKEY,''',14,39,C'''',80:X)
//STEP2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=... input file2 (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//S2 DD DSN=&&S2,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,RECORDS=11,PUSH=(81:ID=8,SEQ=8))
OUTFIL FNAMES=T1
OUTFIL FNAMES=S2,
INCLUDE=(89,8,ZD,EQ,1,AND,14,39,CH,EQ,TARGKEY),
BUILD=(C'TARGID,+',81,8,80:X)
//STEP3 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S2,DISP=(OLD,PASS)
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//SORTOUT DD DSN=... output file (FB/80)
//SYSIN DD *
OPTION COPY
INCLUDE COND=(81,8,ZD,GT,TARGID)
INREC BUILD=(1,80)
/*
|
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|