IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

array handling in commarea.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ramco_sita

New User


Joined: 25 Jun 2007
Posts: 40
Location: chennai

PostPosted: Wed Sep 19, 2007 3:34 pm
Reply with quote

Hi
I am doing a select * from table name.

table name has got custid and custname.

This table has got only 2 rows.

I retrieve the data and move it to the dfhcommarea variable declared as LS-COMM Pic x(100).
when i do a display LS-comm in my cobol and compile it works.(that is i am able to see both the records)

the code that i am using:
IDENTIFICATION DIVISION.
PROGRAM-ID. M22AP01.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
EXEC SQL INCLUDE SQLCA END-EXEC.
EXEC SQL INCLUDE CUST END-EXEC.
EXEC SQL
DECLARE CUR1 CURSOR FOR
SELECT CUSTOMERNO,CUSTOMERNAME FROM CUST
END-EXEC.
01 WS-CUST PIC X(200).
01 COMMAREA-IN.
03 WS-CUSTOMER PIC X(200).
LINKAGE SECTION.
01 DFHCOMMAREA.
03 LS-CUSTOMER PIC X(200).
PROCEDURE DIVISION.
EXEC SQL
OPEN CUR1
END-EXEC.
PERFORM PARA1 UNTIL SQLCODE NOT EQUAL TO 0.
PARA1.
EXEC SQL
FETCH CUR1 INTO :CUSTOMERNO,:CUSTOMERNAME
END-EXEC.
IF SQLCODE = 0
STRING CUSTOMERNAME DELIMITED BY SIZE,
"~" DELIMITED BY SIZE,
CUSTOMERNAME DELIMITED BY SIZE,
"#" DELIMITED BY SIZE
INTO WS-CUST
END-STRING
MOVE WS-CUST TO LS-CUSTOMER.
* DISPLAY LS-CUSTOMER.
* DISPLAY CUSTOMERNAME.
ENDPARA.
EXEC SQL
CLOSE CUR1
END-EXEC.
EXEC CICS RETURN
END-EXEC.
STOP RUN.
My java code has to read that string and display..
Currently it is only displaying the last record in the table.
we need to resolve this quickly.
your guidance is greatly appreciated.
Thanks
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Sep 19, 2007 3:42 pm
Reply with quote

Ignoring several errors, you are overlaying (replacing) the first row with the second row in the move to the commarea.....
If there will only ever be just two rows, set up an additional area to save the first row....
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL Ascending and descending sort n... COBOL Programming 5
No new posts CICS COMMAREA CICS 3
No new posts File Handling COBOL Programming 9
No new posts To find an array of words (sys-symbol... JCL & VSAM 9
No new posts Handling the numeric data in unstring... COBOL Programming 18
Search our Forums:

Back to Top