IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Read Write header detail and Trailer


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
brahmanandarm

New User


Joined: 15 Jun 2009
Posts: 28
Location: bangalore

PostPosted: Fri Feb 19, 2010 10:12 am
Reply with quote

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
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Fri Feb 19, 2010 10:18 am
Reply with quote

Hi,

Show us the input file records, LRECL, RECFM and the scenarios and cases with example, so someone can help.
Back to top
View user's profile Send private message
brahmanandarm

New User


Joined: 15 Jun 2009
Posts: 28
Location: bangalore

PostPosted: Fri Feb 19, 2010 10:35 am
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Feb 19, 2010 11:30 am
Reply with quote

How Header\detail\trailer record is identified?
Back to top
View user's profile Send private message
brahmanandarm

New User


Joined: 15 Jun 2009
Posts: 28
Location: bangalore

PostPosted: Fri Feb 19, 2010 11:37 am
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Feb 19, 2010 12:37 pm
Reply with quote

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
View user's profile Send private message
brahmanandarm

New User


Joined: 15 Jun 2009
Posts: 28
Location: bangalore

PostPosted: Fri Feb 19, 2010 2:40 pm
Reply with 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
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Feb 19, 2010 2:43 pm
Reply with quote

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
View user's profile Send private message
brahmanandarm

New User


Joined: 15 Jun 2009
Posts: 28
Location: bangalore

PostPosted: Fri Feb 19, 2010 2:50 pm
Reply with quote

Hi,

Here is the sample output

ZZ
AA2007-07-12ABCSAM P
DDDDD 00000000000000112121212BRAHMANADA ABC - ACLL COTAT
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Feb 19, 2010 2:56 pm
Reply with quote

Sambhaji wrote:
Can you please show sample input used for this?

Quote:

Hi,

Here is the sample output

I asked for input icon_evil.gif
Back to top
View user's profile Send private message
brahmanandarm

New User


Joined: 15 Jun 2009
Posts: 28
Location: bangalore

PostPosted: Fri Feb 19, 2010 3:13 pm
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Feb 19, 2010 4:01 pm
Reply with quote

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
View user's profile Send private message
brahmanandarm

New User


Joined: 15 Jun 2009
Posts: 28
Location: bangalore

PostPosted: Fri Feb 19, 2010 4:23 pm
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Feb 19, 2010 5:40 pm
Reply with quote

I am clueless on this.. May we need to wait for Frank\Kolusu to come.

Have patience till then..
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Feb 19, 2010 5:57 pm
Reply with quote

vasanthz wrote:
Show us the input file records, LRECL, RECFM and...

brahmanandarm wrote:
...the record lenght varies from file to file...
?????
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Feb 19, 2010 10:56 pm
Reply with quote

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
View user's profile Send private message
brahmanandarm

New User


Joined: 15 Jun 2009
Posts: 28
Location: bangalore

PostPosted: Mon Feb 22, 2010 10:53 am
Reply with quote

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
View user's profile Send private message
brahmanandarm

New User


Joined: 15 Jun 2009
Posts: 28
Location: bangalore

PostPosted: Mon Feb 22, 2010 4:11 pm
Reply with quote

Hi All,

How do i update the trailer record count....
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Feb 22, 2010 4:52 pm
Reply with quote

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
View user's profile Send private message
brahmanandarm

New User


Joined: 15 Jun 2009
Posts: 28
Location: bangalore

PostPosted: Mon Feb 22, 2010 5:02 pm
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Feb 22, 2010 5:08 pm
Reply with quote

Quote:
Trailers are in the following formats.
Senerio1:
ZZ.......
EE0000000
99000005C
Senerio2:
.......á.
FF0000042
FF000015C

What you want us to guess from this? icon_question.gif
Back to top
View user's profile Send private message
brahmanandarm

New User


Joined: 15 Jun 2009
Posts: 28
Location: bangalore

PostPosted: Mon Feb 22, 2010 5:11 pm
Reply with quote

Sorry ... These are in HEX format..

Senerio1: records of 50
ZZ.......
EE0000000
99000005C

Senerio2: records fo 1542
.......á.
FF0000042
FF000015C
Back to top
View user's profile Send private message
brahmanandarm

New User


Joined: 15 Jun 2009
Posts: 28
Location: bangalore

PostPosted: Mon Feb 22, 2010 5:22 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Feb 23, 2010 12:24 am
Reply with quote

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
View user's profile Send private message
brahmanandarm

New User


Joined: 15 Jun 2009
Posts: 28
Location: bangalore

PostPosted: Tue Feb 23, 2010 1:49 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Random read in ESDS file by using RBA JCL & VSAM 6
No new posts Insert header record with record coun... DFSORT/ICETOOL 14
Search our Forums:

Back to Top