Array Processing- Need help



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Array Processing- Need help

Postby luckyboyroh » Thu May 23, 2013 5:39 pm

Hi Friends,

Need you help!

i have a flat file which has old value and corresponding new value. I need to check the input that i get with old value & move the corresponding new value to it.

Input file :
ws-bkr=0014

crossreference file:

old value new value
0014 0015
0016 0015
0017 0015

currently whatever i have in my input file is moved directly to output file.

Output file
ws-bkr=0014

what i require is i need to lookup reference file and move the new value from reference file to putput file

output file
ws-bkr=0015

Please let me know how we can acheive this using arrays. Some code snippet if possible.
Thanks in advance
luckyboyroh
 
Posts: 35
Joined: Wed Jan 16, 2013 4:05 pm
Has thanked: 3 times
Been thanked: 0 time

Re: Array Processing- Need help

Postby Robert Sample » Thu May 23, 2013 6:11 pm

This is a HELP forum, not a WRITE-THE-CODE-FOR-YOU forum. What have you done so far and where are you having problems?

The basic logic is pretty straightfoward:
1. Load the conversion table (by using WORKING-STORAGE constants, or reading the old / new value combinations from a file)
2. For each input record, search the conversion table and move the new value to the old value location

Questions you have not answered:
1. Are you using an input and output file? Input file and output to a data base?
2. What happens if the old value is not found in the conversion table?
3. How many conversion pairs are there?
4. Are the conversion pairs sorted by old value? (If so, and there are a lot -- defined as more than 100 -- of them, you may want to use SEARCH ALL on your table instead of the SEARCH verb).

If you don't know about SEARCH / SEARCH ALL, you need to click on the IBM Manuals link at the top of this page and start reading about them in the COBOL Language Reference manual.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Array Processing- Need help

Postby luckyboyroh » Thu May 23, 2013 8:58 pm

thanks Robert.

i am not familiar with arrays. so just trying something.

yes i am using input/output files only . no database .
if old value is not found on the input reference file,then we move the value from input file itself.
conversion pairs are around 500.
yes,all the old values are sorted . will try using search statement
luckyboyroh
 
Posts: 35
Joined: Wed Jan 16, 2013 4:05 pm
Has thanked: 3 times
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post