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

Removing lines from the input file


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Fri Aug 26, 2011 12:57 am
Reply with quote

Hi,

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]
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri Aug 26, 2011 1:00 am
Reply with quote

Presuming your dataset is FB, how about omitting all of position 1 that's NOT blank?
Back to top
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Fri Aug 26, 2011 1:18 am
Reply with 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?
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri Aug 26, 2011 1:51 am
Reply with quote

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:

Code:

  OPTION COPY
  OMIT COND=(5,1,CH,NE,C' ')
Back to top
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Fri Aug 26, 2011 2:58 am
Reply with quote

Thanks Kevin. It is working now. But I have another condition. I have remove
Code:
 $$FILEM PACK=UNPACK,


Code:
 PRINTOUT=SYSPRINT


this kind of line as well. For this I used
Code:
OPTION COPY
  OMIT COND=((5,1,CH,NE,C' ') ,OR,
                      (6,5,CH,EQ,C'PRINT'),OR,
                      (6,2,CH,EQ,C'$$'))


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]
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Aug 26, 2011 3:26 am
Reply with quote

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.
Back to top
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Fri Aug 26, 2011 3:30 am
Reply with quote

Hi Bill,

Can you provide me any solution . icon_sad.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Aug 26, 2011 3:45 am
Reply with quote

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.
Back to top
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Fri Aug 26, 2011 3:55 am
Reply with quote

Thanks a lot for your suggestion Bill. I have used PARM='VLTESTI=1' and it is working now icon_smile.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Aug 26, 2011 4:00 am
Reply with quote

Glad to hear it. I'll remember that now.

Perhaps, and maybe not just for me, you can explain the options available on VLTESTI?
Back to top
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Fri Aug 26, 2011 4:06 am
Reply with quote

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.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Aug 26, 2011 4:10 am
Reply with quote

Thanks Priyanka.
Back to top
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Fri Aug 26, 2011 9:13 pm
Reply with quote

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.

Please suggest something.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Aug 26, 2011 9:18 pm
Reply with quote

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.
Back to top
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Fri Aug 26, 2011 10:36 pm
Reply with quote

Hi Bill,

Are you asking me to scan through JCL for ||? I am not sure how to do that. I will have to do some googling and let you know the result.

By this time if you or anyone can provide me any other solution that will be great icon_smile.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Aug 26, 2011 10:42 pm
Reply with quote

With the SORT. There is something to scan or search for a character. Sorry to be unclear, but I'm no expert with SORT. No manual.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sat Aug 27, 2011 10:49 am
Reply with quote

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.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sat Aug 27, 2011 2:00 pm
Reply with quote

Quote:
I will have to do some googling and let you know the result.


search the DFSORT forum, lots of examples there
and also regarding the docs some of the DFSORT principles apply also to SYNCSORT

start from here choose a zOS version fro 1.10 UP and wander thru the DFSORT bookshelves
www.ibm.com/systems/z/os/zos/bkserv/index.html

also looking at links provide by Frank for DFSORT advanced utilization might give You good hints on how to proceed
Back to top
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Sun Aug 28, 2011 1:39 am
Reply with quote

I have tried to use SS. But the thing is mine is a VB file and I want to searcg starting from position 1 throuh the entire line.I have also tried

Code:
 SORT FIELDS=COPY
 OMIT COND=(85,maxlrecl-84,SS,EQ,C' ')


It is giving me error at M.
Code:
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                                 
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sun Aug 28, 2011 5:35 am
Reply with quote

Remember I suggested the search for the vertical bars?

Once they are out of the way, look at your report and find the first column which contains data.

For the spaces, try to exclude all records which are shorter than the column with the first piece of data in.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Aug 28, 2011 9:39 am
Reply with quote

Hello,

Quote:
OMIT COND=(85,maxlrecl-84,SS,EQ,C' ')
Why have you made up some syntax of your own. . . icon_confused.gif

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.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Sun Aug 28, 2011 1:43 pm
Reply with quote

Check in the documentation the meaning of SS in:
Code:
  OMIT COND=(20,30,SS,EQ,C'|')


Edit: again and again, i forgot to check page 2 and i'm late !! icon_evil.gif
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sun Aug 28, 2011 4:58 pm
Reply with quote

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.
Code:
//STEP01   EXEC PGM=SORT,PARM='VLTESTI=2' 
//SYSOUT   DD  SYSOUT=*                   
//SORTIN   DD  DSN= Input file  (VBA/32756)
//SORTOUT  DD  DSN= Output file (VBA/32756)
//SYSIN    DD  *                           
 OPTION COPY                               
 OMIT COND=(6,1,CH,NE,C' ',OR,             
            6,5,CH,EQ,C'PRINT',OR,         
            6,2,CH,EQ,C'$$',OR,           
            6,32750,SS,EQ,C'||',OR,       
            1,2,BI,EQ,5)
SORTIN
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                   
                                      |||||                     
                          |||||                             
                                                       |||||
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   
Back to top
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Mon Aug 29, 2011 9:32 pm
Reply with quote

Hi Arun,

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. icon_sad.gif

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 
                                                                 
0DEFAULT SET FUNCTION VALUES:                                   
                                                                 
 PRINTOUT=SYSPRINT  HEADERPG=YES  ASCII=NO       RECLIMIT=(1,*) 
 PRINTLEN=132       PAGESKIP=NO   PAD=OFF        MSGUPPER=NO     
 PAGESIZE=60        DATAHDR=YES   PRTCLASS=A     LANGUAGE=ENGLISH
 PRTTRANS=ON        DUMP=UPDOWN   TAPELBL=SL     CYLHD=ABSOLUTE 
 SMFNO=000          PRTDISP=MOD   USEIOX=DISABLE IOX=           
                                                           
 TEMP UNIT=SYSALLDA DATA=         STOR=          MANAGEMENT=
 PERM UNIT=SYSALLDA DATA=         STOR=          MANAGEMENT=
 TRACECLS=A                                                 
                                                           
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:                         


My sort Card:

Code:
//SYSIN    DD  *                       
    SORT FIELDS=COPY                   
       OMIT COND=(6,1,CH,NE,C' ',OR,   
                  6,5,CH,EQ,C'PRINT',OR,
                  6,2,CH,EQ,C'$$',OR,   
                  1,2,BI,EQ,5)         
/*                                     
[/code]

It seems it has removed all my comparison result. icon_sad.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Aug 29, 2011 9:52 pm
Reply with quote

It looks to me that Arun has taken your data from your first post and given you OMIT conditions to give you the output you wanted.

You have since changed the format of the data.

Code:
6,1,CH,NE,C' ',


is getting rid of most of the stuff that you want, because it now starts in column six, instead of later as in your original.
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 -> JCL & VSAM Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 4
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
Search our Forums:

Back to Top