Page 1 of 1

Array Processing- Need help

PostPosted: Thu May 23, 2013 5:39 pm
by luckyboyroh
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

Re: Array Processing- Need help

PostPosted: Thu May 23, 2013 6:11 pm
by Robert Sample
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.

Re: Array Processing- Need help

PostPosted: Thu May 23, 2013 8:58 pm
by luckyboyroh
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