Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading 10 MB Flat file into Working storage Variables 1

Status
Not open for further replies.

Nits1212

Programmer
Aug 16, 2007
34
IN

Hi,

I have a input file with 10 MB data in size. I want to read the corresponding 10 MB file into Temporary working storage variables and then i am going to convert that data into MQ message data. Can somebody will tell me, how i can read this 10 MB data in working storage variables? is it possible to do it by using COBOL ARRAY? Please suggest...

Thank you,

Regards,
Nits
 
Nits,

after you load the data into WS-DATA-STRING, the value of WS-DATA-LENGTH should equal the size of the data loaded. From your description, you tried to load more data than could be stored in WS-DATA-STRING. So, the value in WS-DATA-LENGTH is greater than the size of WS-DATA-STRING.

Try DISPLAY'ing the value of WS-DATA-LENGTH before DISPLAY'ing the contents of WS-DATA-STRING.

According to your original post, WS-DATA-STRING is not defined long enough. The OCCURS value you coded is only slightly more than 1 MB, not the 10 MB you originally stated.
Code:
03 WS-DATA-STRING.
   05  OCCURS 1 TO [COLOR=#ff0000]1048576[/color] DEPENDING ON WS-DATA-LENGTH
                 PIC X(01).

Truus,

great explanation of the solution!

Code what you mean,
and mean what you code!
But by all means post your code!

Razalas
 
Ok Sir,
I will test it and will update u on the same..
Thanks..
 
01 ws-lage-area usage external.
03 WS-large-part pic x(1000) occurs 1000 indexed
by WS-large-idx.

The above logic is not working to remove the spaces.

Like above logic say, occurs 1000 times, if i have only 10 records, then rest of the 990 record spaces should get removed... but i am not able to remove the spaces with the above command
 
I mean, i am not able to remove the spaces by using USAGE EXTERNAL command.. plz suggest..
 
Nits,

I suggest you carefully re-read Truus' post of 8/23/07 @ 2:03.

It sounds like you are confusing two different suggested approaches to your problem. The first, using an array (i.e. Cobol table) of n rows by m chars/row, which won't meet your requirement to eliminate trailing spaces. The second, using a 1-dimensional, variable-length array (Cobol table) and STRING'ing your input records consecutively into that array, will work. The second is approach is the one given by Truus in the post referred to above.

Please note that Truus' solution does not require your input records to be stored in an intermediate table. Rather, his solution implies that you STRING each input record directly into the array storage (that will be passed to MQ) as they are read into the program.

Code what you mean,
and mean what you code!
But by all means post your code!

Razalas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top