View previous topic :: View next topic
|
Author |
Message |
maheswaran Radhakrishnan
New User
Joined: 18 Mar 2011 Posts: 7 Location: UK
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
maheswaran Radhakrishnan
New User
Joined: 18 Mar 2011 Posts: 7 Location: UK
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
maheswaran Radhakrishnan
New User
Joined: 18 Mar 2011 Posts: 7 Location: UK
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Crystal Ball On
"can it be done in one step?"
Crystal Ball Off
Frank: No answer for me required |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Hopefully, your crystal ball is a bit cloudy today. |
|
Back to top |
|
|
maheswaran Radhakrishnan
New User
Joined: 18 Mar 2011 Posts: 7 Location: UK
|
|
|
|
Thanks a lot Sir...It worked. |
|
Back to top |
|
|
maheswaran Radhakrishnan
New User
Joined: 18 Mar 2011 Posts: 7 Location: UK
|
|
|
|
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 |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Sorry, we were not looking over your shoulder watching what you were doing......
What did you try? What abend? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
maheswaran Radhakrishnan
New User
Joined: 18 Mar 2011 Posts: 7 Location: UK
|
|
|
|
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 |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
maheswaran Radhakrishnan
New User
Joined: 18 Mar 2011 Posts: 7 Location: UK
|
|
|
|
Thank You very much. It worked. |
|
Back to top |
|
|
|