View previous topic :: View next topic
|
Author |
Message |
ajayvamsi
New User
Joined: 21 Jul 2005 Posts: 56 Location: Hyderabad
|
|
|
|
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 |
|
|
prasadvrk
Active User
Joined: 31 May 2006 Posts: 200 Location: Netherlands
|
|
|
|
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 |
|
|
ajayvamsi
New User
Joined: 21 Jul 2005 Posts: 56 Location: Hyderabad
|
|
|
|
Prasad,I cannot change the copybook
Please help out with out changing the copybook
Thanks
ajay |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
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 |
|
|
|