View previous topic :: View next topic
|
Author |
Message |
brahmanandarm
New User
Joined: 15 Jun 2009 Posts: 28 Location: bangalore
|
|
|
|
Hi All,
Would need to read the file
1. If the file contains header detail and trailer then write header ONE detail and trailer record to the output file.
2. If the file contains only detail record then write ONE detail record to the output file.
3. If the file contains header and trailer then write header and trailer
Can some one help me to solve above quey using ICETOOL. |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Hi,
Show us the input file records, LRECL, RECFM and the scenarios and cases with example, so someone can help. |
|
Back to top |
|
|
brahmanandarm
New User
Joined: 15 Jun 2009 Posts: 28 Location: bangalore
|
|
|
|
Hi,
We would need to run a batch stream where there are some JOBs which uses previous day files.(we found around 200 previous day files).
So we plan to copy header one detail and trailer record from previous day files in order to complete the stream.
So, the record lenght varies from file to file (as we have 200 previous day files).
Pleas advice if there are any generic tool to copy. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
How Header\detail\trailer record is identified? |
|
Back to top |
|
|
brahmanandarm
New User
Joined: 15 Jun 2009 Posts: 28 Location: bangalore
|
|
|
|
Hi,
we have few Scenarios
Scenario 1:
Header starts with AA
Detail starts with DD
Trailer start with ZZ
Scenario 2:
Header starts with 00
Detail starts with 0A
Trailer start with FF
Scenario 3:
Header starts with 00
Detail starts with 03
Trailer start with FF |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Hi Brahmanandaram,
Below sortcard will give you desired result...
It will work for all scenarios you have shown.
Code: |
//S1 EXEC PGM=SORT
//SORTIN DD DSN=your dsn here,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,2,AQ,A)
ALTSEQ CODE=(C1F2,C6F9,C4F3,E9F9)
SUM FIELDS=NONE
|
|
|
Back to top |
|
|
brahmanandarm
New User
Joined: 15 Jun 2009 Posts: 28 Location: bangalore
|
|
|
|
Thanks a lot it is working
The out put is
Trailer
Header
Detail
Could you plase let me know how to create the out put as
Header
Detail
Trailer |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Quote: |
Thanks a lot it is working
The out put is
Trailer
Header
Detail
Could you plase let me know how to create the out put as
Header
Detail
Trailer
|
Can you please show sample input used for this? |
|
Back to top |
|
|
brahmanandarm
New User
Joined: 15 Jun 2009 Posts: 28 Location: bangalore
|
|
|
|
Hi,
Here is the sample output
ZZ
AA2007-07-12ABCSAM P
DDDDD 00000000000000112121212BRAHMANADA ABC - ACLL COTAT |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Sambhaji wrote: |
Can you please show sample input used for this?
|
Quote: |
Hi,
Here is the sample output
|
I asked for input |
|
Back to top |
|
|
brahmanandarm
New User
Joined: 15 Jun 2009 Posts: 28 Location: bangalore
|
|
|
|
Sorry..
Here is the sample Input
Code: |
AA2007-07-12HFRINS D
DDDDD 00000000000000111111111MBRBRAHMAN ABC - AXEA VOERL
DDDDD 00000000000000232131231MALLIKAJUN RED - ABYC EREAD
DDDDD 000000000000001212161212MIREREEAIA AEA TESTING
DDDDD 00000000000000121210911LMI REDDO EVW TESTING
ZZ |
|
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Code: |
//S1 EXEC PGM=SORT
//SORTIN DD *
AA2007-07-12HFRINS D
DDDDD 00000000000000111111111MBRBRAHMAN ABC - AXEA VOERL
DDDDD 00000000000000232131231MALLIKAJUN RED - ABYC EREAD
DDDDD 000000000000001212161212MIREREEAIA AEA TESTING
DDDDD 00000000000000121210911LMI REDDO EVW TESTING
ZZ
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,2,AQ,A)
ALTSEQ CODE=(C1F2,C6F9,C4F3,E9F9)
SUM FIELDS=NONE
|
Output:
Code: |
AA2007-07-12HFRINS D
DDDDD 00000000000000111111111MBRBRAHMAN ABC - AXEA VOERL
ZZ
|
|
|
Back to top |
|
|
brahmanandarm
New User
Joined: 15 Jun 2009 Posts: 28 Location: bangalore
|
|
|
|
hi,
In my case i am not geeting the correct fromat
Code: |
//JS010 EXEC PGM=SORT,
// REGION=0M
//SORTIN DD DISP=SHR,DSN=ABC.INPUT.TEST
//SORTOUT DD DSN=ABC.OUTPUT.TEST,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(100,(1,2),RLSE),
// UNIT=SYSDA
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,2,AQ,A)
ALTSEQ CODE=(C1F2,C6F9,C4F3,E9F9)
SUM FIELDS=NONE |
OUTPUT
Code: |
ZZ.......
AA2007-07-12HFRINS D
DDDDA..00000000000000850462041LMILMIAANZ LMI - FULL COVER 000 |
|
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
I am clueless on this.. May we need to wait for Frank\Kolusu to come.
Have patience till then.. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
vasanthz wrote: |
Show us the input file records, LRECL, RECFM and... |
brahmanandarm wrote: |
...the record lenght varies from file to file... |
????? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
brahmanandarm,
I tried Sambhaji's solution for all three cases and it works fine, although this would be a simpler way of doing it with DFSORT:
Code: |
SORT FIELDS=(1,2,AC,A)
SUM FIELDS=NONE
|
If it's not working for you, then I can only guess that your RECFM is VB so the identifier actually starts in position 5 (after the RDW), not in position 1, in which case you would use:
Code: |
SORT FIELDS=(5,2,AC,A)
SUM FIELDS=NONE
|
If your RECFM is FB, then there's something else you're not telling us so you need to show the complete job you're using and the //SYSOUT messages you received. |
|
Back to top |
|
|
brahmanandarm
New User
Joined: 15 Jun 2009 Posts: 28 Location: bangalore
|
|
|
|
Hi,
The RECFM is VB and is working fine .........
Is their any way where we can execute the step with either of the record format (VB or FB) |
|
Back to top |
|
|
brahmanandarm
New User
Joined: 15 Jun 2009 Posts: 28 Location: bangalore
|
|
|
|
Hi All,
How do i update the trailer record count.... |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Quote: |
Hi All,
How do i update the trailer record count....
|
You are just repeating mistake of not stating your requirement properly\completely...
Where is the count? What format count is in?
Till now none of the examples given has count at trailer record |
|
Back to top |
|
|
brahmanandarm
New User
Joined: 15 Jun 2009 Posts: 28 Location: bangalore
|
|
|
|
Here is the sample code
Hi,
//JS010 EXEC PGM=SORT
//SORTIN DD DISP=SHR,DSN=AIW.ABC.MBR
//SORTOUT DD DSN=AIW.ABC.TEST,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(100,(2,2),RLSE)
// DCB=*.SORTIN
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(5,2,AQ,A)
ALTSEQ CODE=(C1F2,C6F9,C4F3,E9F9)
SUM FIELDS=NONE
Would nee the Trailer update the trailer count.
Trailers are in the following formats.
Senerio1:
ZZ.......
EE0000000
99000005C
Senerio2:
.......á.
FF0000042
FF000015C |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Quote: |
Trailers are in the following formats.
Senerio1:
ZZ.......
EE0000000
99000005C
Senerio2:
.......á.
FF0000042
FF000015C
|
What you want us to guess from this? |
|
Back to top |
|
|
brahmanandarm
New User
Joined: 15 Jun 2009 Posts: 28 Location: bangalore
|
|
|
|
Sorry ... These are in HEX format..
Senerio1: records of 50
ZZ.......
EE0000000
99000005C
Senerio2: records fo 1542
.......á.
FF0000042
FF000015C |
|
Back to top |
|
|
brahmanandarm
New User
Joined: 15 Jun 2009 Posts: 28 Location: bangalore
|
|
|
|
Very sorry if you are confusing..
JS010 EXEC PGM=SORT
SORTIN DD DISP=SHR,DSN=AAA.ABC.MBR
SORTOUT DD DSN=AAA.ABC.TEST,
DISP=(NEW,CATLG,DELETE),
UNIT=SYSDA,SPACE=(100,(2,2),RLSE),
DCB=*.SORTIN
SYSOUT DD SYSOUT=*
SYSIN DD *
SORT FIELDS=(5,2,AQ,A)
ALTSEQ CODE=(C1F2,C6F9,C4F3,E9F9)
SUM FIELDS=NONE
The Above sort copies Header ,(One)Detail and Trailer reocrd to optput file 'AAA.ABC.TEST'.
Need to update Trailer record of the out put file as it has only one detail record.
Senerio1:
Trailer start with ZZ
Senerio2:
Trailer start with FF
Please let me know how to update the trailer record. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
It's still not clear what you want to do.
Please show an example of the records in each input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files. |
|
Back to top |
|
|
brahmanandarm
New User
Joined: 15 Jun 2009 Posts: 28 Location: bangalore
|
|
|
|
Here are more details..
Input FILE
AA2007-07-12ABCDE D
DDDDD 00000000000000111111111MBRBRAHMAN ABC - AXEA VOERL
DDDDD 00000000000000232131231MALLIKAJUN RED - ABYC EREAD
DDDDD 000000000000001212161212MIREREEAIA AEA TESTING
DDDDD 00000000000000121210911LMI REDDO EVW TESTING
ZZ
OUTPUT:
AA2007-07-12ABCDE D
DDDDD 00000000000000111111111MBRBRAHMAN ABC - AXEA VOERL
ZZ
Here the output trilar record(Packed Decimal) has record count of 4 where it has to be 1.
I have used the fllowing code:
//S1 EXEC PGM=SORT
//SORTIN DD *
AA2007-07-12HFRINS D
DDDDD 00000000000000111111111MBRBRAHMAN ABC - AXEA VOERL
DDDDD 00000000000000232131231MALLIKAJUN RED - ABYC EREAD
DDDDD 000000000000001212161212MIREREEAIA AEA TESTING
DDDDD 00000000000000121210911LMI REDDO EVW TESTING
ZZ
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,2,AQ,A)
ALTSEQ CODE=(C1F2,C6F9,C4F3,E9F9)
SUM FIELDS=NONE
Please let me know how to update the trialer count.
(The output of abouve query alwas has one record) I am fine with updating(Default) as 1 for Trailer Record. |
|
Back to top |
|
|
|