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

How to write the missing records


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
tarunflash

New User


Joined: 15 Oct 2005
Posts: 25

PostPosted: Sat Dec 10, 2005 9:43 pm
Reply with quote

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
View user's profile Send private message
Ramya A

Active User


Joined: 26 Jul 2004
Posts: 104

PostPosted: Sun Dec 11, 2005 4:58 am
Reply with quote

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
View user's profile Send private message
tarunflash

New User


Joined: 15 Oct 2005
Posts: 25

PostPosted: Sun Dec 11, 2005 10:24 am
Reply with quote

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
View user's profile Send private message
Ramya A

Active User


Joined: 26 Jul 2004
Posts: 104

PostPosted: Mon Dec 12, 2005 12:06 am
Reply with quote

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
View user's profile Send private message
tarunflash

New User


Joined: 15 Oct 2005
Posts: 25

PostPosted: Mon Dec 12, 2005 9:14 pm
Reply with quote

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
View user's profile Send private message
tarunflash

New User


Joined: 15 Oct 2005
Posts: 25

PostPosted: Thu Dec 15, 2005 1:17 pm
Reply with quote

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
View user's profile Send private message
Ramya A

Active User


Joined: 26 Jul 2004
Posts: 104

PostPosted: Thu Dec 15, 2005 7:07 pm
Reply with quote

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
View user's profile Send private message
tarunflash

New User


Joined: 15 Oct 2005
Posts: 25

PostPosted: Fri Dec 16, 2005 10:11 am
Reply with quote

can i have the code please
Back to top
View user's profile Send private message
tarunflash

New User


Joined: 15 Oct 2005
Posts: 25

PostPosted: Tue Dec 20, 2005 8:17 pm
Reply with quote

Hi

it is not working.it is writing only if there are two missing records.
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 -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top