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

How to write the record count in the Header of a file


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

New User


Joined: 18 Mar 2011
Posts: 7
Location: UK

PostPosted: Fri Mar 18, 2011 6:36 pm
Reply with quote

Hello All,

I have a fixed length sequential file. I want to write the record count of the file in the header record. The record count should not consider the header record. The file details are

LRECL = 83
Type = FB
Record Count starting position = 9 (Length is 6)

Note:
There is no record type associated with the file.

Thanks a lot for your help.
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 Mar 18, 2011 10:23 pm
Reply with quote

Please show an example of the records in your input file (relevant fields only) and what you expect for output.

Note that adding a trailer with the record count is much easier than adding a header with the record count. Is there some reason you need the count in a header instead of in a trailer?
Back to top
View user's profile Send private message
maheswaran Radhakrishnan

New User


Joined: 18 Mar 2011
Posts: 7
Location: UK

PostPosted: Mon Mar 21, 2011 3:39 pm
Reply with quote

101210311000000 ----------> Header record (Record cnt starts at pos 10)
Detail record (Length 83 (82-83 are spaces)
9002103111030231000S000999999999787888900000012345678900000100000012340100000000
1002103111030231000S000999999999987878900000012345678900000100000012340100000000
2002103111030231000S000999999999187878900000012345678900000100000012340100000000
3002103111030231000S000999999999287878900000012345678900000100000012340100000000
4002103111030231000S000999999999387878900000012345678900000100000012340100000000


Thanks for your help
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: Mon Mar 21, 2011 10:50 pm
Reply with quote

If you can't be bothered to post clear information about your requirements, then how can you expect anyone to help you?

Is the header record present in the input file and you just want to update the existing header record? Or do you want to add a new header record that doesn't exist in the input file?

Again:

Please show an example of the records in your input file (relevant fields only) and what you expect for output.

Please resolve this contradiction in your two posts.

Quote:
Record Count starting position = 9 (Length is 6)


Quote:
Record cnt starts at pos 10
Back to top
View user's profile Send private message
maheswaran Radhakrishnan

New User


Joined: 18 Mar 2011
Posts: 7
Location: UK

PostPosted: Tue Mar 22, 2011 3:51 pm
Reply with quote

Sorry for the confusion caused. Please find the attached example data.
The attached file is the input one with the header having the record count as '000000' starting at 7th position. Now the requirement is that a new file has to be created with the same data without any change in the order and the header count value should be updated as '000004' (Excluding the header)
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: Wed Mar 23, 2011 1:25 am
Reply with quote

Here's a DFSORT job that will do what you asked for:

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file (FB/83)
//SYM DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYSIN DD *
  OPTION COPY
  OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,
    BUILD=(1,80),
    TRAILER1=('DATCT,''',COUNT-1=(EDIT=(TTTTTT)),'''')
  OUTFIL FNAMES=T1,
    OVERLAY=(84:SEQNUM,8,ZD)
/*
//S2 EXEC PGM=SORT
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//SORTOUT DD DSN=...  output file (FB/83)
//SYSIN DD *
  OPTION COPY
  INREC IFOUTLEN=83,
    IFTHEN=(WHEN=(84,8,ZD,EQ,1),OVERLAY=(7:DATCT))
/*
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Wed Mar 23, 2011 1:52 am
Reply with quote

Crystal Ball On

"can it be done in one step?"

Crystal Ball Off

Frank: No answer for me required
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: Wed Mar 23, 2011 2:32 am
Reply with quote

Hopefully, your crystal ball is a bit cloudy today. icon_lol.gif
Back to top
View user's profile Send private message
maheswaran Radhakrishnan

New User


Joined: 18 Mar 2011
Posts: 7
Location: UK

PostPosted: Thu Mar 24, 2011 3:26 pm
Reply with quote

Thanks a lot Sir...It worked.
Back to top
View user's profile Send private message
maheswaran Radhakrishnan

New User


Joined: 18 Mar 2011
Posts: 7
Location: UK

PostPosted: Thu Mar 24, 2011 3:50 pm
Reply with quote

The attached file is the input one with the header having the record count as '000000' starting at 9th position. Now the requirement is that a new file has to be created with the same data without any change in the order and the header count value should be updated as '000004' (Excluding the header).How the same process can be applied for the below given input file

LRECL = 34
TYPE = FB

I tried doing it but got an abend instead.

Thanks for your help
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Thu Mar 24, 2011 4:02 pm
Reply with quote

Sorry, we were not looking over your shoulder watching what you were doing......
What did you try? What abend?
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: Thu Mar 24, 2011 10:39 pm
Reply with quote

maheswaran,

PLEASE STOP posting screenshots. Just post inline text with ubb code tags around it.

This "new" requirement is just a simple variation of the previous requirement. You just have to tweak the previous job a bit. Please work harder at figuring out these things for yourself.

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file (FB/34)
//SYM DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYSIN DD *
  OPTION COPY
  OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,
    BUILD=(80X),
    TRAILER1=('DATCT,''',COUNT-1=(EDIT=(TTTTTT)),'''')
  OUTFIL FNAMES=T1,
    OVERLAY=(35:SEQNUM,8,ZD)
/*
//S2 EXEC PGM=SORT
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//SORTOUT DD DSN=...  output file (FB/34)
//SYSIN DD *
  OPTION COPY
  INREC IFOUTLEN=34,
    IFTHEN=(WHEN=(35,8,ZD,EQ,1),OVERLAY=(9:DATCT))
/*


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080
Back to top
View user's profile Send private message
maheswaran Radhakrishnan

New User


Joined: 18 Mar 2011
Posts: 7
Location: UK

PostPosted: Fri Mar 25, 2011 4:23 pm
Reply with quote

Thanks a lot for the quick reply. I tried the above code but it gave the below given error message

OPTION COPY
OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,
BUILD=(1,80),
TRAILER1=('DATCT,''',COUNT-1=(EDIT=(TTTTTT)),'''')
OUTFIL FNAMES=T1,
OVERLAY=(35:SEQNUM,8,ZD)

ICE201I G RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE027A 9 END OF SYM FIELD BEYOND MAXIMUM RECORD LENGTH
ICE751I 0 C5-K59561 C6-K51707 C7-K54603 C8-K51707 E9-K51707 E7-K51707

How to overcome this?
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Mar 25, 2011 10:33 pm
Reply with quote

maheswaran Radhakrishnan wrote:
Thanks a lot for the quick reply. I tried the above code but it gave the below given error message

OPTION COPY
OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,
BUILD=(1,80),


Change the BUILD statement in the above to BUILD=(80X), and rerun your job.
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 Mar 25, 2011 11:45 pm
Reply with quote

My mistake. I forgot the input file had LRECL=34 this time. As Kolusu says, just use 80X instead of 1,80. I've updated my job.
Back to top
View user's profile Send private message
maheswaran Radhakrishnan

New User


Joined: 18 Mar 2011
Posts: 7
Location: UK

PostPosted: Mon Mar 28, 2011 2:43 pm
Reply with quote

Thank You very much. It worked.
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

 


Similar Topics
Topic Forum Replies
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts To get the count of rows for every 1 ... DB2 3
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top