Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

array handling in commarea.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: array handling in commarea.
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: 2150
Location: At my coffee table

PostPosted: Wed Sep 19, 2007 3:42 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts COMMAREA and CHANNELS menonkiran CICS 4 Tue Apr 04, 2017 8:14 am
No new posts Dynamic array request/response contai... Suja.Sai CICS 2 Tue Jan 24, 2017 11:37 am
No new posts Unstring list of values into an array. Roshnii COBOL Programming 8 Mon Jun 27, 2016 6:25 pm
No new posts ON ERROR handling soundarr PL/I & Assembler 2 Wed May 11, 2016 3:37 am
No new posts Exception Handling in Native Stored P... Mariraj DB2 1 Thu Feb 25, 2016 4:08 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us