I want to remove few lines from input file depending on some criterion.
File file looks like
Code:
1IBM File Manager for z/OS
0
-
0FMNBA001 IBM File Manager for z/OS Version 11 Release 1
0FMNBA010 Not APF authorized
0FMNBA010 Service Levels of installed components
0FMNBA010 Base IMS DB2 CICS
0FMNBA010 English UK66921 UK66925 UK66923 UK66274
New data set fields: NAME SURNAME
ID NREC-# OREC-# <---+---> <---+--->
I 000001 abcd klgjk
I 000003 hhjh jlkjlj
Old data set fields: NAME SURNAME
ID NREC-# OREC-# <---+---> <---+--->
D 000002 aaaaa bbbb
C 000004 fffffff yyyy
O 000003 sgg lllll
|||||
I want to remove all the lines above 'New data set fields:'. I tried to do it using OMIT COND=(1,1,CH,EQ,C'0',or....) but it is not removed. Please suggest.[/quote]
This file has the same layout of the input file. The input file is a FB. But while crating this file it is becoming VBA. So do I need to change itto FB first? Or there is some other way to do it?
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
Well, if the dataset is VBA, then you should know that the first four bytes are reserved for the Record Descriptor Word (RDW) and that they need to be taken into account. The fifth byte is the ASA Carriage-Control, and byte six and on is the rest of the data.
So, an easy SORT OMIT statement might be coded like:
But this is giving me ABEND and the message is like
Code:
SYNCSORT FOR Z/OS 1.4.0.0R U.S. PATENTS: 4210961, 5117495 (C) 2010 S
JOHN HANCOCK FINANCIAL SERVICES z/OS
SYNCSORT LICENSED FOR CPU SERIAL NUMBER 2EF15, MODEL 2098 P02
SYSIN :
SORT FIELDS=COPY 00
OMIT COND=(6,2,CH,EQ,C'$$') 00
WER276B SYSDIAG= 14506, 448289, 448289, 980625
WER164B 9,900K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 24K BYTES RESERVE REQUESTED, 2,324K BYTES USED
WER146B 20K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I SORTIN : RECFM=VBA ; LRECL= 32756; BLKSIZE= 32760
WER073I SORTIN : DSNAME=ORD.PYNPRIY.TEST.SYSPRINT
WER110I SORTOUT : RECFM=VBA ; LRECL= 32756; BLKSIZE= 32760
WER074I SORTOUT : DSNAME=ORD.PYNPRIY.TEST.CHANGED.HILITD
WER410B 7,848K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,
WER410B 0 BYTES RESERVE REQUESTED, 2,184K BYTES USED
WER055I INSERT 0, DELETE 0
WER250A INCLUDE/OMIT FIELD BEYOND RECORD
Could you please tell me what is the problem. I am sorry for the long message but I really have no clue how to solve this error. Please suggest something to solve this.[/quote]
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
You are not getting an Abend. Your step is not completing successfully, but that is a different thing.
This is the problem:
Quote:
WER250A INCLUDE/OMIT FIELD BEYOND RECORD
It would seem that all the lines in your print output are at least one byte long (actually 5, including the RDW). However, there are certainly some which are less than 11 bytes long. On encountering the first of those, the SORT does not know how to proceed.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
As I've just written for another post, I dont' have a SyncSORT manual.
You need to "protect" the test from a short record. I'm sure there is a "proper" way to do this (I've seen reference to it in this forum, you'd have to search, try looking for "short record" or the error message you got, try google if the forum search doesn't work for you). Or hit your manual.
If you are desperate tonight, try changing it to INCLUDE (remembering to swap your condition around) and before the test that must be longer than one byte, test the record-lenght for less than 8/11 (whatever, check) so that all the short ones are included before you do the test for those you want to exclude).
If you can't get to the proper solution yourself, someone will come up with it tommorow I'm sure, if you are able to wait that long.
It's in the manual...... However I am just copying this for reference
The delivered default of 0 instructs SyncSort to terminate if a record does not completely contain all INCLUDE or OMIT fields. A WER250A critical error message is generated to indicate this condition.
When VLTESTI=1 is specified, a record that does not completely contain all INCLUDE/OMIT fields is treated as having failed the comparison. SyncSort will omit the record if INCLUDE is being used or include the record if OMIT has been specified.
When VLTESTI=2 is specified, SyncSort will treat comparisons to fields not completely contained within the record as false and decide a record?s status for inclusion or omission from fields that are available. If all fields are not present, the record will be processed as having failed the comparison. SyncSort will omit the record if INCLUDE is being used or include the record if OMIT has been specified.
I have one more requrement. My file looks like as below
Code:
New data set fields: NAME SURNAME
ID NREC-# OREC-# <---+---> <---+--->
I 000001 mmmmmmm nnnn
I 000003 rrrrr ggggg
Old data set fields: NAME SURNAME
ID NREC-# OREC-# <---+---> <---+--->
D 000002 rrrrrr ggggg
C 000004 sssssss hhhhh
O 000003 sssssss ppp
|||||
I need to remove all the blank lines i.e. all the lines which have nothing at all(there will be lines which will have '||' in the lines and their position cannot be pre determind)from my output file. I cannot put OMIT COND=((5,1,CH,NE,C' ') as this will remove all the lines whose first position is blank including the last line which I dont want.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
I guess you could "scan" for the "||" and omit/not include.
Then choose a position which is always populated (first non-blank looks OK from your sample) and omit/not include blank in that position. Should work with your VLTESTI setting.
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Priyanka Pyne,
You could use 'SS' to search for a string and INCLUDE/OMIT the record based on its presence of absence irrespective of its position in the record. I am away from work and can't run a test now.
SYNCSORT FOR Z/OS 1.4.0.0R U.S. PATENTS: 4210961, 5117495 (C) 2010 SYNCSO
JOHN HANCOCK FINANCIAL SERVICES z/OS 1.1
SYNCSORT LICENSED FOR CPU SERIAL NUMBER 2EF15, MODEL 2098 P02 LICEN
SYSIN :
OPTION VLSHRT
SORT FIELDS=COPY
OMIT COND=(85,maxlrecl-84,SS,EQ,C' ')
*
WER251A INCLUDE/OMIT INVALID LENGTH
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
Hello,
Quote:
OMIT COND=(85,maxlrecl-84,SS,EQ,C' ')
Why have you made up some syntax of your own. . .
One way to do what you want might be to specify the maximum length of any record and allow for short records. . . Read about VLTEST in your manual or search in this JCL part of the forum.
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Priyanka Pyne,
The below Syncsort job does what you're trying to achieve. Note that I have used VLTESTI=2 so that Syncsort does the comparison against the fields available instead of failing the comparison for short records.
1IBM File Manager for z/OS
0
-
0FMNBA001 IBM File Manager for z/OS Version 11 Release 1
0FMNBA010 Not APF authorized
0FMNBA010 Service Levels of installed components
0FMNBA010 Base IMS DB2 CICS
0FMNBA010 English UK66921 UK66925 UK66923 UK66274
New data set fields: NAME SURNAME
ID NREC-# OREC-# <---+---> <---+--->
I 000001 abcd klgjk
I 000003 hhjh jlkjlj
Old data set fields: NAME SURNAME
ID NREC-# OREC-# <---+---> <---+--->
D 000002 aaaaa bbbb
C 000004 fffffff yyyy
O 000003 sgg lllll
|||||
|||||
|||||
SORTOUT
Code:
New data set fields: NAME SURNAME
ID NREC-# OREC-# <---+---> <---+--->
I 000001 abcd klgjk
I 000003 hhjh jlkjlj
Old data set fields: NAME SURNAME
ID NREC-# OREC-# <---+---> <---+--->
D 000002 aaaaa bbbb
C 000004 fffffff yyyy
O 000003 sgg lllll
I tried with your code snippet. I need '|' in my output file so I slightly changed your sort card. But my out put is totally different from yours.
Input File:
Code:
1IBM File Manager for z/OS
0
-
0FMNBA001 IBM File Manager for z/OS Version 11 Release 1
0FMNBA010 Not APF authorized
0FMNBA010 Service Levels of installed components
0FMNBA010 Base IMS DB2 CICS
0FMNBA010 English UK66921 UK66925 UK66923 UK66274
1IBM File Manager for z/OS
0$$FILEM DSCMP TYPE=FORMATTED,
$$FILEM PACK=UNPACK,
$$FILEM SYNCH=KEYED,
$$FILEM KEYLOCOLD=1,
$$FILEM KEYLOCNEW=1,
$$FILEM KEYLEN=6,
$$FILEM KEYTYPE=CHAR,
$$FILEM LIST=LONG,
$$FILEM WIDE=YES,
$$FILEM HILIGHT=YES,
$$FILEM CHNGDFLD=YES,
$$FILEM IGNLEN=YES,
$$FILEM EXCLUDE=(,,MATCHED,),
$$FILEM NUMDIFF=ALL,
$$FILEM DSNOLD=xxxxx.TEST.VSAM.FILE1,
$$FILEM TCOLD=DEB.xxxxx.LCS.JOBLIB2(VSAM),
$$FILEM LANG=COBOL,
$$FILEM SKIPOLD=0,
$$FILEM CMPOLD=ALL,
$$FILEM TCNEW=DEB.xxxxx.LCS.JOBLIB2(VSAM),
$$FILEM SKIPNEW=0,
$$FILEM CMPNEW=ALL,
$$FILEM DSNNEW=xxxxx.TEST.VSAM.FILE2
1IBM File Manager for z/OS
0* * * * Formatted comparison with keyed synchronization
* * New data set: xxxxx.TEST.VSAM.FILE2
* * using copybook DEB.xxxxx.LCS.JOBLIB2(VSAM)
* * Old data set: xxxxx.TEST.VSAM.FILE1
* * using copybook DEB.xxxxx.LCS.JOBLIB2(VSAM)
* * Output data sets:
* * Inserted: ORD.xxxxx.TEST.INSERTED.T
* * Deleted: ORD.xxxxx.TEST.DELETED.T
* * New Changed: ORD.xxxxx.TEST.CHANGED.T
New data set fields: NAME SURNAME
ID NREC-# OREC-# <---+---> <---+--->
I 000001 mmmmmmm nnnn
I 000003 rrrrr ggggg
Old data set fields: NAME SURNAME
ID NREC-# OREC-# <---+---> <---+--->
D 000002 ddddd ggggg
C 000004 sssssss ggggg
O 000003 sssssss ppp
|||||
1IBM File Manager for z/OS
0Comparison summary:
Old data set records processed: 3
New data set records processed: 4
Matching records found: 1
Changed records: 1
Old records not selected: 0
New records not selected: 0
Old records not compared: 0
New records not compared: 0
Old data set records deleted: 1
New data set records inserted: 2
Output data set records written:
Inserted: 2
Deleted: 1
New Changed: 1
Synchronization: Keyed 1 1 6 AN
Comparison type: Formatted
Listing type: Long
Listing exclusions: Matched
Listing options: Wide listing
Highlight changes
Show changed fields only
Template reporting options:
0FMNBA709 Compare sets don't match
Output:
Code:
0
-
|||||
Old data set records processed: 3
New data set records processed: 4
Matching records found: 1
Changed records: 1
Old records not selected: 0
New records not selected: 0
Old records not compared: 0
Old data set records deleted: 1
New data set records inserted: 2
Output data set records written:
Inserted: 2
Deleted: 1
New Changed: 1
Synchronization: Keyed 1 1 6 AN
Comparison type: Formatted
Listing type: Long
Listing exclusions: Matched
Listing options: Wide listing
Highlight changes
Show changed fields only
Template reporting options: