|
View previous topic :: View next topic
|
| Author |
Message |
sureshkumar_p01
New User
Joined: 22 Feb 2007 Posts: 7 Location: bangalore
|
|
|
|
I have a requirement where i need to eliminate certain records from the input VB file (lrecl - 9072) and write it to a new file with the trailer count updated.
The below is one which i have coded:
| Code: |
//S1 EXEC PGM=SORT,PARM='VLTESTI=1'
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Input File,DISP=SHR
//SORTOUT DD DSN=Output file,UNIT=PRIME,
// DISP=(MOD,KEEP,DELETE),
// SPACE=(23476,(1000,1000),RLSE),
// DCB=(RECFM=VB,LRECL=9072,BLKSIZE=23476)
//SYSIN DD *
OPTION COPY
OMIT COND=(14,3,CH,EQ,C'180')
INREC FIELDS=(1,4,5:5,9068,
9073:SEQNUM,5,PD)
OUTREC IFTHEN=(WHEN=(5,4,CH,EQ,X'FFFFFFFF',AND,
9,16,CH,EQ,C'XXXXXXXXXXXXXXXX'),
BUILD=(1,4,5,20,(9073,5,PD,SUB,+2),30,9032)),
IFTHEN=(WHEN=NONE,
BUILD=(1,4,5,9068))
/*
|
I got the following error message:
WER108I SORTIN : RECFM=VB ; LRECL= 9072; BLKSIZE= 23476
WER257I INREC RECORD LENGTH = 9077
WER238I POTENTIALLY INEFFICIENT USE OF INREC
WER237I OUTREC RECORD LENGTH = 9072
WER110I SORTOUT : RECFM=VB ; LRECL= 9072; BLKSIZE= 23476
WER410B 7,848K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,
WER410B 0 BYTES RESERVE REQUESTED, 2,207,192 BYTES USED
WER055I INSERT 0, DELETE 0
WER244A INREC - SHORT RECORD
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
PS:
I have made a search on this forum regarding this but did not find much useful info.
Thanks,
Suresh |
|
| Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
| And what does WER244A say in the manual ? |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| Code: |
INREC FIELDS=(1,4,5:5,9068,
9073:SEQNUM,5,PD) |
Suresh,
VB files should n't be padded at the end like fixed length files. By doing so, you just lose the indidual record lengths. If you want to attach some identifier to a VB file, always insert it at the beginning of the record immediately after the RDW field. |
|
| Back to top |
|
 |
sureshkumar_p01
New User
Joined: 22 Feb 2007 Posts: 7 Location: bangalore
|
|
|
|
Hi,
Thanks for ur suggestions.
I tried having the SEQNUM field in the front though not immediately after RDW. This worked and the code looks as showns below.
| Code: |
//S1 EXEC PGM=SORT,PARM='VLTESTI=1'
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Input File,DISP=SHR
//SORTOUT DD DSN=Output File,UNIT=PRIME,
// DISP=(MOD,KEEP,DELETE),
// SPACE=(23476,(1000,1000),RLSE),
// DCB=(RECFM=VB,LRECL=9072,BLKSIZE=23476)
//SYSIN DD *
OPTION COPY
OMIT COND=(14,3,CH,EQ,C'180')
INREC FIELDS=(1,4,5,20,25:SEQNUM,5,PD,30:25)
OUTREC IFTHEN=(WHEN=(5,4,CH,EQ,X'FFFFFFFF',AND,
9,16,CH,EQ,C'XXXXXXXXXXXXXXXX'),
BUILD=(1,4,5,20,25:(25,5,PD,SUB,+7),PD,41:35,9026)),
IFTHEN=(WHEN=NONE,
BUILD=(1,4,5,20,25:30))
/* |
The above code still has some issues with the trailer count field. The trailer count field in input file is defined as PD and is of 5 bytes in length. But now the updated trailer count occupies 8 bytes instead of 5 bytes in the output file. The value of trailer count in both the input file and output file is shown below :
Input File (HEX ON):
Output File (HEX ON):
| Code: |
........
00000213
0000076C |
Kindly help me on this.
Thanks,
Suresh
Edited: Please use BBcode when You post some code/error, that's rather readable, Thanks... Anuj |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
Suresh,
Can you please explain what you're trying to achieve with the above code? |
|
| Back to top |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Hi sureshkumar_p01,
I try to eidt your code but not sure what is that "h" in your input, is that really a part of your input? And yes please show some sample input and expected output with rules to get better replies. When you post your input and output please use BBcode. |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
Suresh,
Also post the starting position and lengths of relevant fields in your input file. |
|
| Back to top |
|
 |
sureshkumar_p01
New User
Joined: 22 Feb 2007 Posts: 7 Location: bangalore
|
|
|
|
Hi Arun,
My aim is to achieve the following things using the above code:
1. Remove all records which has 180 in position 14,3.
OMIT COND=(14,3,CH,EQ,C'180')
2. Add a SEQNUM in position 25 which will be used to update the trailer count.
INREC FIELDS=(1,4,5,20,25:SEQNUM,5,PD,30:25)
3. My file has 5 header and 5 trailer records. And i want to update the second trailer record. The reason to update this particular trailer is because this is the one which contains the count of records which has '180' in position 14,3 which we have omitted. That is why i substract 7 from the SEQNUM.
BUILD=(1,4,5,20,25:(25,5,PD,SUB,+7),PD,41:35,9026))
4. i want the trailer count to be displayed in PD format and of length 5 in the output file. But the trailer count field in the second trailer record of output file is of 8 bytes instead of 5 bytes.
Input File (HEX ON):
...h.
00283
0068C
Output file (HEX ON): Desired output File (HEX ON):
........ .....
00000213 00213
0000076C 0076C
Hope i have made myself clear.
Thanks,
Suresh |
|
| Back to top |
|
 |
sureshkumar_p01
New User
Joined: 22 Feb 2007 Posts: 7 Location: bangalore
|
|
|
|
Hi,
Sorry there were some formatting issues in the previous post.
input file trailer count field:
...h.
00283
0068C
Output File trailer Count field:
.....
00213
0076C
Hi Anuj,
watever fields i have posted under input and output files those are jus the trailer counts. Hope i have answered ur ques.
Desired output File trailer count field:
........
00000213
0000076C |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| Are you sure that you have only '7' '180' type records? |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| Quote: |
3. My file has 5 header and 5 trailer records. And i want to update the second trailer record. The reason to update this particular trailer is because this is the one which contains the count of records which has '180' in position 14,3 which we have omitted. That is why i substract 7 from the SEQNUM.
BUILD=(1,4,5,20,25:(25,5,PD,SUB,+7),PD,41:35,9026)) |
If your input trailer is already having a count, why dont u try subtracting '7' from the existing count field in the trailer. Why would you need a SEQNUM to count it again? Let me know if I am missing something. |
|
| Back to top |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Hello,
Suggest you to post rather complete sample input, expected output & rules along with LRECL & BLKSIZE of input output. What you are trying may be a way to achieve what you want but it's not working for you now - for us to help you it's better we know what is being expected.
You say
| Quote: |
| My file has 5 header and 5 trailer records. And i want to update the second trailer record. |
but your sample input shows only one (probably "h" was to show header). I again say, showing rather complete sample input, expected output & rules along with LRECL & BLKSIZE of input/output might fetch better answer else we'll just guesstimate. |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| Quote: |
| but your sample input shows only one (probably "h" was to show header) |
Anuj,
OP's sample input shows the 'HEX ON' version of the PD count field in the trailer.
| Code: |
000001 h
00283
0068C
------------
000002
00213
0076C |
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|