Page 1 of 1

EASYTRIEVE ARRAY ISSUE

Posted: Wed Dec 07, 2011 7:04 pm
by sahiljethi
Hi,

I have a task, where I have to write the different occurances of an array in an output file. I have written a loop to read through all occurances of array.

But my program is only displaying the first instance correctly, all other instances of array are appearing as spaces.

Please help me!!!!

Code: Select all

 FILE INAUDIT
   IN-ARRAY               1  1750 A
*-------------------------------------------
 WS-ARRAY                W    35  A OCCURS 50
 WS-SUB2                  W    2   N  

*-------------------------------------------
 JOB INPUT INAUDIT
    MOVE IN-ARRAY TO WS-ARRAY 
    WS-SUB2 = 1
    DO WHILE (WS-SUB2 LE 50)                                
       DISPLAY WS-SUB2 ' :' WS-ARRAY (WS-SUB2)
       WS-SUB2 = WS-SUB2 + 1                                
    END-DO                                                  
 GOTO JOB

Input Data:
S 525 : : : :2010022520100225 F 88I : : : :2009122820091228

Output:
1:S 525 : : : :2010022520100225
2:
3:
-
-
49:
50:

[/code]

Posted: Wed Dec 07, 2011 11:22 pm
by DikDude
Looks like the array was not loaded properly. . .

You provided nothing to work with, so identifying problems becomes most idfficult.

For someone to help, you need to show how the array is loaded and that the values are correct before the loop t display them.

Posted: Thu Dec 08, 2011 3:49 pm
by sahiljethi
Dikdude,

This was the complete job, which i specified in my last post & actual input from my file.

Input file has record length of 1750. I want to divide this data into parts of 35 bytes and display each part.

After displaying the first part successfully, prog displays all other parts as spaces.

Please let me know other details you require?

Posted: Fri Dec 09, 2011 2:36 am
by DikDude
MOVE IN-ARRAY TO WS-ARRAY
After this statement, display ws-array and see what you have. . . I suspect it will not be what you are expecting. . .

On the initial read, i did not recognize that the posted code was ALL of the code :oops:

Posted: Fri Dec 09, 2011 1:46 pm
by sahiljethi
I did as you said; and turned out to be what u said "I suspect it will not be what you are expecting."

MOVE IN-ARRAY TO WS-ARRAY - This only moved the first 35 bytes of In-ARRAY to WS-ARRAY;

Please let me know what can be done for moving all the 1750 bytes to WS-ARRAY??

Also, I checked that SPACES is not acceptable keyword in EASYTRIEVE....then how do we check whether an alphanumeric variable contains data in EASYTRIEVE.

Thanks,
Sahil

Posted: Fri Dec 09, 2011 4:13 pm
by sahiljethi
Thanks for ur help, I fixed the array issue by changing the array defination :lol:
http://code.xmlgadgets.com/2010/09/20/o ... asytrieve/

Please help me with "SPACES is not acceptable keyword in EASYTRIEVE....then how do we check whether an alphanumeric variable contains data or not"

Posted: Sat Dec 10, 2011 12:22 pm
by DikDude
Yup, the cobol SPACES is not available in EASYTRIEVE (AS FAR AS I KNOW).

Define a WS field of the maximum spaces you need and compare against these. Or use an inline ' ' literal in the code.

Re: EASYTRIEVE ARRAY ISSUE

Posted: Wed Aug 17, 2016 11:10 am
by satishmtechmf
I am also Facing same issue did any body knows how to load array...Please help...