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

Skip lines in a file thru JCL


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Avinash_Gupta

New User


Joined: 11 May 2005
Posts: 26
Location: Hyderabad

PostPosted: Wed Sep 20, 2006 6:22 pm
Reply with quote

Hi,

I want to know a method to skip certain lines in a afile and write a new file. For intasnce I have a file whose initial few line are
000001
000002
000003 2006-09-20 03.24.48
000004 1 AVINASH OPERATIONS --
000005 SHIFTS ALLOWANCE
000006 PAY PERIOD
000007 CAE: INDIA
Now i need to write a new file until i encounter AVINASH. On encountering the word AVINASH , THe rest of the file is written into a new file.

Please let me know if we can do this thru an utility.
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Wed Sep 20, 2006 7:24 pm
Reply with quote

Hi !

You can use the IDCAMS Utility with SKIP parameter to allwasy skip the
first four records.

Regards, UmeySan
Back to top
View user's profile Send private message
Avinash_Gupta

New User


Joined: 11 May 2005
Posts: 26
Location: Hyderabad

PostPosted: Wed Sep 20, 2006 8:10 pm
Reply with quote

Hi, Actually the lines would not be constant on the top. So to be on the safer side , I want ot skip all the lines until I ecnounter the word AVINASH as mentioned above in the file.

is there a way for doing that?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Sep 20, 2006 8:27 pm
Reply with quote

Do the sequence numbers actually appear in the input file? What position does AVINASH start in?

What is the RECFM and LRECL of the input file?

Do you want the records up to and including AVINASH in output file1 and the records after AVINASH in output file2? If not, what do you want exactly? It would help if you showed the expected output.
Back to top
View user's profile Send private message
Avinash_Gupta

New User


Joined: 11 May 2005
Posts: 26
Location: Hyderabad

PostPosted: Wed Sep 20, 2006 8:47 pm
Reply with quote

NO sequence numbers dont appear in the file.That appeared whn i copied the file..The LRECL is 133 and RECFM=FBA.

My expected output is :
000001 1 AVINASH OPERATIONS --
000002 SHIFTS ALLOWANCE
000003 PAY PERIOD
000004 CAE: INDIA
Actually even in the input file the indentation was centre. What i want in the output file is all the records in the file after AVINASH ..Its basically all records including the line AVINASH. what is getting skipped is the first two empty lines and the DATE.
Please let me know if you have any more clarifications?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Sep 20, 2006 10:37 pm
Reply with quote

Here's a DFSORT job that will do what you asked for. You didn't answer my question "What position does AVINASH start in?" so I assumed it started in position 4. If not, you can change the INCLUDE=(4,... parameter appropriately.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FBA/133)
//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
  INREC OVERLAY=(134:SEQNUM,8,ZD)
  OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,
    INCLUDE=(4,7,CH,EQ,C'AVINASH'),
    OUTREC=(80X),
    HEADER1=('TARGET,+',134,8)
  OUTFIL FNAMES=T1
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//SORTOUT DD DSN=...  output file (FBA/133)
//SYSIN    DD    *
  OPTION COPY
  INCLUDE COND=(134,8,ZD,GE,TARGET)
  OUTREC BUILD=(1,133)
/*
Back to top
View user's profile Send private message
Avinash_Gupta

New User


Joined: 11 May 2005
Posts: 26
Location: Hyderabad

PostPosted: Thu Sep 21, 2006 8:33 pm
Reply with quote

Hi Frank,

You are great..the job above worked for me like a magic. I didnt have to modify anything. It did the work as expected.

But i didnt follow much. Could you please take the pain to xplain me what the job did. Also what are the terms
OUTFIL FNAMES=SYM,REMOVECC,NODETAIL

Thanks a lot once again.

Avinash
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu Sep 21, 2006 9:58 pm
Reply with quote

The first step adds a sequence number to each record, finds the record with 'AVINASH' and uses its sequence number (n) to create a DFSORT symbol like this in the SYM data set:

TARGET,+n

It also copies all of the records with sequence numbers to the T1 data set.

The second step uses the T1 data set (with sequence numbers) as input. It uses the TARGET symbol in the SYM data set in an INCLUDE statement to only keep the records with sequence numbers greater than or equal to the TARGET sequence number.

Code:

  OUTFIL FNAMES=SYM,REMOVECC,NODETAIL


FNAMES=SYM specifies the output DD name of SYM.

REMOVECC tells DFSORT not to use ANSI carriage control characters in position 1 (these are used for a report). We don't want a carriage control character for the TARGET,+n symbol we create.

NODETAIL tells DFSORT not to write out the detail records. All we want is one header record for the TARGET,+n symbol we create.

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:

Use [URL] BBCode for External Links
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top