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.
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.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
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.
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?
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
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.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
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: