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

Need program logic for the VSAM manipulation


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sumivel

New User


Joined: 13 Sep 2005
Posts: 18

PostPosted: Fri Oct 28, 2005 7:08 pm
Reply with quote

i am new to mainframes so,could anyone help me on this below problem
i have two files with following record structures.
file-1.
*******

primary key :reg-no
---------------------------------------------
REg-no Nric1 nric2 nric3 nric4
---------------------------------------------
123 aaaa ccccc eeeee ffff
456 wwww yyyyy
----------------------------------------------


file2
******

primary key : reg-no and nric.
reg-no nric name
--------------------------
123 aaaa xxxxxxxxx
123 bbbb xxxxxxxx
123 cccc xxxxxxxxx
123 dddd xxxxxxxxx
123 eeee xxxxxxxxx
123 ffff xxxxxxxxx
456 vvvv xxxxx
456 wwww xxxxx
456 xxxx xxxxx
456 yyyy xxxxxxxxxx

both the files are vsam files
i have to browse the file2 until eof
or change in regestration number.

my report file should be like this

-----------------------------


s.no regn-no nric name
------------------------------------------------------
1 123 aaaa xxxxxxx
cccc xxxxxxx
eeee xxxxxxx
ffff xxxxxxx


bbbb xxxxxxx
dddd xxxxxxx

2 456 wwww xxxxxxxx
yyyy xxxxxxxx


vvvv xxxxxxx
xxxx xxxxxxx.

can any one give me program logic for
the above problem.
Back to top
View user's profile Send private message
EnjoyMF

New User


Joined: 27 May 2005
Posts: 88

PostPosted: Sat Oct 29, 2005 12:00 pm
Reply with quote

Hi

this can be done by cobol program & sort utility
in cobol program

1. open 2 files
perform read-file until file-status = '10'
2. read the 1st file ,& get the data of ist record into the copy book
3.perform file2-read until ws-eor='y'
set 'n' to ws-eor( working storage of picx(1))
read the 2nd file
if regno of 1st file Not = reg-no of 2nd file
set 'y' to ws-eor
else
Nric1 of 1st file = nric of 2nd file or
Nric2 of 1st file = nric of 2nd file or
Nric3 of 1st file = nric of 2nd file or
Nric4 of 1st file = nric of 2nd file
if Satisfied populate the data to 3rd ile as of like this
1 123 aaaa xxxxxxx
cccc xxxxxxx
eeee xxxxxxx
ffff xxxxxxx
else populate
bbbb xxxxxxx
dddd xxxxxxx


4 close both the files
*************************************************************
But the logic has an issue , how should we handle the records of 2nd file
that ie
file 1
111 aaaa
222 bbbb
333 cccc

file2
111 aaaa ppppp
555 bbbb ttttttt
666 gggg ddddd

if the input of the files area like above, then we are not taking care of
file2 ( 555, 666 )
************************************************************

i am not sure how to do with sort, if i get to know i will post it

Thanks
prasad
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
Search our Forums:

Back to Top