View previous topic :: View next topic
|
Author |
Message |
dinesh_deadman Warnings : 1 New User
Joined: 10 Aug 2007 Posts: 32 Location: Chicago
|
|
|
|
Hello Frank,
I have a scenario which can be done by a COBOL program. However, I was wondering if we could do it thru sort. Let me make you understand it.
INPUT FILE:
1. AA12345
2. BB12345
3. CC33333
4. DD33333
5. DD33333
6. DD33333
7. EE55555
8. FF555555
All the above records form a set of records, so basically AA is like 00 BB 01 CC 02... so on and so forth...
Requirement is based on the value in 3rd record i.e, CC some value in 1st record AA should get picked up.
Is this possible in SORT/ICETOOL?
If you think I AM JUST NOT CLEAR don't bash me up... I am patient enuf to right with a few more details.
Thanks,
Dinesh |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Not enough information....
Your best bet is to provide what you expect the output will look like and explain why..... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
In addition to the output Bill requested, please specify the processing rules. When you show the output, show the complete output from all input posted, not just the first iteration.
It will also help if you mention the recfm and lrecl for the input and output. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
Requirement is based on the value in 3rd record i.e, CC some value in 1st record AA should get picked up. |
I don't understand what you mean by this. What is the relationship betwee the CC record and the AA record? What are the exact rules for the requirement? Please provide the info William and Dick asked for. |
|
Back to top |
|
|
dinesh_deadman Warnings : 1 New User
Joined: 10 Aug 2007 Posts: 32 Location: Chicago
|
|
|
|
Sorry folks,
I was a lil busy with somethin else. Anyway,
this is how the input looks.
001122334455 (Header record)
01ASDFASDFASDF
02ASDFASDFASDF
03AAAAA
04ASDFASDFASDF
05ASDFASDFASDF
99ASDFASDFASF(TRAILER RECORD)
002233445566 (Header record)
01ASDFASDFASDF
02ASDFASDFASDF
03AAAAA (after 03 the data is junk... could be anything)
04ASDFASDFASDF
05ASDFASDFASDF
99ASDFASDFASF(TRAILER RECORD)
003344556677 (Header record)
01ASDFASDFASDF
02ASDFASDFASDF
04ASDFASDFASDF
05ASDFASDFASDF
99ASDFASDFASF(TRAILER RECORD)
Output should be:
1122334455
2233445566
(these are the account numbers picked from '00' record type)
only...
and not
3344556677 just because in the 3rd set of records there is no record
that starts with 03(which is record type) |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
You want the account number from the header record if there exists an 03 type record between the header (00) and the trailer (99), right? |
|
Back to top |
|
|
dinesh_deadman Warnings : 1 New User
Joined: 10 Aug 2007 Posts: 32 Location: Chicago
|
|
|
|
Bad ending... I just forgot...
neway... if you happen to understand please give me the solution... else, ask me... FOR A BETTER EXPLANATION...
Thanks |
|
Back to top |
|
|
dinesh_deadman Warnings : 1 New User
Joined: 10 Aug 2007 Posts: 32 Location: Chicago
|
|
|
|
That's right... William... bang on!!! |
|
Back to top |
|
|
dinesh_deadman Warnings : 1 New User
Joined: 10 Aug 2007 Posts: 32 Location: Chicago
|
|
|
|
I am sorry for late updates...
it is possible to have more than 1 '03' record type...
IF SOMEBODY IS READY WITH THE SOLUTION AND THEN SAW THIS MESSAGE... MY APOLOGIES... |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
dinesh,
Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but you can change the job appropriately for other attributes.
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (FB/80)
//OUT DD DSN=... output file (FB/10)
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(81,8,ZD) FIRSTDUP USING(CTL1)
/*
//CTL1CNTL DD *
INCLUDE COND=(1,2,SS,EQ,C'00,03')
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(1,2,CH,EQ,C'00'),
OVERLAY=(81:SEQNUM,8,ZD)),
IFTHEN=(WHEN=NONE,
OVERLAY=(89:SEQNUM,8,ZD,
81:81,8,ZD,SUB,89,8,ZD,M11,LENGTH=8))
OUTFIL FNAMES=OUT,BUILD=(3,10)
/*
|
|
|
Back to top |
|
|
dinesh_deadman Warnings : 1 New User
Joined: 10 Aug 2007 Posts: 32 Location: Chicago
|
|
|
|
Awesome! Thanks Frank... |
|
Back to top |
|
|
|