Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: How to write the record count in the Header of a file
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 Moderator


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

PostPosted: Fri Mar 18, 2011 10:23 pm    Post subject:
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    Post subject: Reply to: How to write the record count in the Header of a f
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 Moderator


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

PostPosted: Mon Mar 21, 2011 10:50 pm    Post subject:
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    Post subject: Reply to: How to write the record count in the Header of a f
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 Moderator


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

PostPosted: Wed Mar 23, 2011 1:25 am    Post subject:
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: 645
Location: Pennsylvania

PostPosted: Wed Mar 23, 2011 1:52 am    Post subject:
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 Moderator


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

PostPosted: Wed Mar 23, 2011 2:32 am    Post subject:
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    Post subject: Reply to: How to write the record count in the Header of a f
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    Post subject: Reply to: How to write the record count in the Header of a f
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: 1715
Location: UK

PostPosted: Thu Mar 24, 2011 4:02 pm    Post subject:
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 Moderator


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

PostPosted: Thu Mar 24, 2011 10:39 pm    Post subject:
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:

http://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    Post subject: Reply to: How to write the record count in the Header of a f
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    Post subject:
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 Moderator


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

PostPosted: Fri Mar 25, 2011 11:45 pm    Post subject:
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    Post subject: Reply to: How to write the record count in the Header of a f
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us