View previous topic :: View next topic
|
Author |
Message |
tarunflash
New User
Joined: 15 Oct 2005 Posts: 25
|
|
|
|
i have a file which contains records as below
01 00 001 34
02 00 001 23
03 00 001 34
05 00 001 34
06 00 001 21
07 00 001 21
09 00 001 21 etc
using JCL is there any way to write the missed records (for eg in the above there is 04 & 06) .by using jcl can we write the records in to the output file with all the missed records.
means before writing it has to check whether first column contains records sequentially or not if not it has to write those record also . |
|
Back to top |
|
|
Ramya A
Active User
Joined: 26 Jul 2004 Posts: 104
|
|
|
|
I understand your question like this:
Input:
01 00 001 34
02 00 001 23
03 00 001 34
05 00 001 34
06 00 001 21
07 00 001 21
09 00 001 21
Final output:
01 00 001 34
02 00 001 23
03 00 001 34
04
05 00 001 34
06 00 001 21
07 00 001 21
08
09 00 001 21
if so, here is one way I can think of...
step 1: Create a sequential file with sequence of numbers (to be checked). Say file2:
Eg:
Your input file - File1
01 00 001 34
02 00 001 23
03 00 001 34
05 00 001 34
06 00 001 21
07 00 001 21
09 00 001 21
The file that you create in step 1: - File2
01
02
03
04
05
06
07
08
09
Step 2: Do a Sort - XSUM with file1 and file2 based on first 2 chars (The sequence number). Sortout is the output that you are looking for:
SORTOUT:
01 00 001 34
02 00 001 23
03 00 001 34
04
05 00 001 34
06 00 001 21
07 00 001 21
08
09 00 001 21
Let me know if my understanding is correct....
Rgds,
Ramya |
|
Back to top |
|
|
tarunflash
New User
Joined: 15 Oct 2005 Posts: 25
|
|
|
|
thanks for your reply.ya your understanding is correct but i need missing row should look like as below
04 00 001 00
first two values it should take from previous record and last value should b e zero since it is a missing record.
can u give me the code |
|
Back to top |
|
|
Ramya A
Active User
Joined: 26 Jul 2004 Posts: 104
|
|
|
|
Will all your missing records will have a constant value "00 001 00" from position 4? If so, you just need to change your first step to create the sequence record as below:
01 00 001 00
02 00 001 00
03 00 001 00
04 00 001 00
05 00 001 00
06 00 001 00
07 00 001 00
08 00 001 00
09 00 001 00
You could do this using the following sort card:
SORT FIELDS=COPY
OUTREC FIELDS=(SEQNUM,02,ZD,C' 00 001 00')
if you give 30 empty lines in the input, you'll get 30 records in the output with the above sequence...
Hope this helps.
Ramya |
|
Back to top |
|
|
tarunflash
New User
Joined: 15 Oct 2005 Posts: 25
|
|
|
|
thanks for your reply.but the program itself should find all the records are in sequential order or not if not it has to write that paticular missed record with the same constant value |
|
Back to top |
|
|
tarunflash
New User
Joined: 15 Oct 2005 Posts: 25
|
|
|
|
only for the missing records it should contain constant value as
00 001 00
others should contain their old values from the record
eg.
01 00 001 34
02 00 001 23
03 00 001 34
04 00 001 00
05 00 001 34
06 00 001 21
07 00 001 21
08 00 001 00
09 00 001 21
thanks,
tarun |
|
Back to top |
|
|
Ramya A
Active User
Joined: 26 Jul 2004 Posts: 104
|
|
|
|
if you do the 2 steps that I've told:
1. Create a sequence file (Used for missing records) as I've told in my previous mail.
2. Do a sort XSUM.
This would give you the result that you are asking for:
01 00 001 34
02 00 001 23
03 00 001 34
04 00 001 00
05 00 001 34
06 00 001 21
07 00 001 21
08 00 001 00
09 00 001 21
Let me know if you tried and it didn't work that way.
Ramya |
|
Back to top |
|
|
tarunflash
New User
Joined: 15 Oct 2005 Posts: 25
|
|
|
|
can i have the code please |
|
Back to top |
|
|
tarunflash
New User
Joined: 15 Oct 2005 Posts: 25
|
|
|
|
Hi
it is not working.it is writing only if there are two missing records. |
|
Back to top |
|
|
|