Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Skip lines in a file thru JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Skip lines in a file thru JCL
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: 757
Location: Germany

PostPosted: Wed Sep 20, 2006 7:24 pm    Post subject:
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    Post subject: clarification
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 Moderator


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

PostPosted: Wed Sep 20, 2006 8:27 pm    Post subject:
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    Post subject: Reply
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 Moderator


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

PostPosted: Wed Sep 20, 2006 10:37 pm    Post subject:
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    Post subject: Thanks
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 Moderator


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

PostPosted: Thu Sep 21, 2006 9:58 pm    Post subject:
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:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 0 Tue Sep 26, 2017 3:35 am
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 8 Fri Sep 22, 2017 11:35 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Skip file from delete pema_yozer All Other Mainframe Topics 3 Tue Aug 29, 2017 3:19 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us