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

Reading the file randomly can I use THRU clause


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

New User


Joined: 21 Jul 2005
Posts: 56
Location: Hyderabad

PostPosted: Mon Jun 12, 2006 9:05 am
Reply with quote

the below code which I reading the file randomly can I use THRU clause here for the record key
defining the file as:--

SELECT JARBI-FILE
ASSIGN TO JARBI
ORGANIZATION INDEXED
ACCESS RANDOM
FILE STATUS WS-JABI-STATUS
RECORD KEY JABI-KEY-LOGO THRU
JABI-KEY-CREDIT-PLAN.


copy book:=

01 primarykey.
02 JABI-KEY-name
02 JABI-KEY-LOGO
02 JABI-KEY-age
02 JABI-KEY-CREDIT-PLAN
02 JABI-KEY-city


please tell me if this wrong and tell me how to code the primary using the fields JABI-KEY-LOGO,JABI-KEY-age,JABI-KEY-CREDIT-PLAN only

Thanks
ajay
Back to top
View user's profile Send private message
prasadvrk

Active User


Joined: 31 May 2006
Posts: 200
Location: Netherlands

PostPosted: Mon Jun 12, 2006 1:46 pm
Reply with quote

If you can change your copy book then you can as well declare the three fields that make the key as one
01 primarykey.
02 JABI-KEY-name
02 PRIMARYKEYS
05 JABI-KEY-LOGO
05 JABI-KEY-age
05 JABI-KEY-CREDIT-PLAN
02 JABI-KEY-city

and use that field as RECORD KEY

SELECT JARBI-FILE
ASSIGN TO JARBI
ORGANIZATION INDEXED
ACCESS RANDOM
FILE STATUS WS-JABI-STATUS
RECORD KEY PRIMARYKEYS.

Offcourse you can try this only if can change the copy book
Back to top
View user's profile Send private message
ajayvamsi

New User


Joined: 21 Jul 2005
Posts: 56
Location: Hyderabad

PostPosted: Mon Jun 12, 2006 2:04 pm
Reply with quote

Prasad,I cannot change the copybook
Please help out with out changing the copybook

Thanks
ajay
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Mon Jun 12, 2006 7:47 pm
Reply with quote

ajay,

You cannot use the 'THRU' statement in this context.

You only have two options that I see.

1 - define and create a secondary index for the file only with the fields your interested in. I think you may be able to do this under your own ID, I'm not sure, I've never tried. This is not efficient because the system will have to sequentialy read the entire file to create the index.

2 - Sequentialy read the file, picking out the records you need. Probably, overall the fastest way.

Dave
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top