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
 

 

Implement pseudo-conversation in PL/I with CICS
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
ranjini_S01

New User


Joined: 15 Feb 2008
Posts: 12
Location: bangalore

PostPosted: Fri May 23, 2008 1:11 pm    Post subject: Implement pseudo-conversation in PL/I with CICS
Reply with quote

Hi,
I am trying to implement pseudo-conversation in PL/I. But i am struck at the declaration of DFHCOMMAREA.
could anyone tell me how & where to declare DFHCOMMAREA?
Also how to implement pseudoconversation in PL/I?
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Fri May 23, 2008 1:20 pm    Post subject: Reply to: PL/I with CICS
Reply with quote

the same way as in any other language

wherever You feel confortable to enhance program readability,
pli does not have the COBOL idiosyncrasies about &working_storage variable placement

... process the data
... write to the screen
... RETURN TRANSID
Back to top
View user's profile Send private message
ranjini_S01

New User


Joined: 15 Feb 2008
Posts: 12
Location: bangalore

PostPosted: Fri May 23, 2008 3:16 pm    Post subject:
Reply with quote

I am trying out this program which is not working for me. Kindly guide me.

[ the map displays five fields of a record fetched from database table ]

PGM:
PROCEDURE OPTIONS(MAIN);
%INCLUDE M862;
EXEC SQL INCLUDE SQLCA;
EXEC SQL INCLUDE EMPL9354; /* DCLGEN of table EMPLOYEE */

EXEC CICS IGNORE CONDITION
MAPFAIL;
DCL DFHCOMMAREA CHAR(5) STATIC;

DCL COMMAREA_DATA CHAR(5);
DCL EMP_KEY CHAR(5);

IF EIBCALEN=0 THEN
DO;
COMMAREA_DATA='AAAAA';
CALL SEND_MAP;
CALL RETURN_CTRL;
END;
ELSE
DO;
COMMAREA = DFHCOMMAREA;
SELECT(EIBAID);
WHEN(DFHENTER)
DO;
CALL RECEIVE_MAP;
CALL PROCESS_PROC;
END;
WHEN(DFHPF3)
DO;
CALL EXIT_PGM;
END;
END;
END;

SEND_MAP:PROC;
EXEC CICS SEND MAP('MAP') MAPSET('M862') FREEKB ERASE;
END SEND_MAP;

RECEIVE_MAP:PROC;
EXEC CICS RECEIVE MAP('MAP') MAPSET('M862');
END RECEIVE_MAP;

RETURN_CTRL:PROC;
EXEC CICS RETURN
TRANSID('SR01')
COMMAREA(COMMAREA_DATA)
LENGTH(5);
END RETURN_CTRL;

PROCESS_PROC:PROC;
EMP_KEY = FIELD1I;

EXEC SQL SELECT EMPNAME INTO :DCLEMPLOYEE
FROM EMPLOYEE
WHERE EMPNO=:EMP_KEY;
IF SQLCODE = 0 THEN
BEGIN;
FIELD2I = WS_EMPNAME
FIELD3I = WS_ADDRESS
FIELD4I = WS_CONTACT
FIELD5I = WS_DOB
CALL SEND_MAP;
CALL RETURN_CTRL;
END;
END PROCESS_PROC;

EXIT_PGM: PROC;
EXEC CICS
SEND CONTROL
ERASE;
END EXIT_PGM;

END PGM;
END PGM;
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Fri May 23, 2008 3:26 pm    Post subject: Reply to: PL/I with CICS
Reply with quote

not working is a bit generic, as a symptom
Back to top
View user's profile Send private message
ranjini_S01

New User


Joined: 15 Feb 2008
Posts: 12
Location: bangalore

PostPosted: Fri May 23, 2008 3:57 pm    Post subject:
Reply with quote

The transaction gets abended with abend code=4038. What might be the reason for this?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Fri May 23, 2008 4:10 pm    Post subject: Reply to: PL/I with CICS
Reply with quote

Quote:
U4038 (X'FC6')

Explanation: The enclave ended with an unhandled Language Environment software-raised or user-raised condition of severity 2 or greater, and the run-time option ABTERMENC(ABEND) was specified.

Programmer Response: Check the Language Environment message file for message output.

System Action: Enclave terminated.
Back to top
View user's profile Send private message
ranjini_S01

New User


Joined: 15 Feb 2008
Posts: 12
Location: bangalore

PostPosted: Mon May 26, 2008 11:44 am    Post subject:
Reply with quote

Can you be more specific regarding Language Environment?

I never encountered this when i run COBOL-CICS programs.

Even when I execute a simple program which just sends a message to the CICS terminal, i have not encountered this abend code.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon May 26, 2008 7:50 pm    Post subject:
Reply with quote

Hello,

The U4038 is also somewhat generic.

There is additional diagnostic information somewhere and you will need to find/post that.

Many systems have some standard error handling code - is such available on your system? This will not fix the abend, but will help clrify what is wrong.

You might also talk with your system support people.
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 990
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Wed May 28, 2008 2:19 pm    Post subject:
Reply with quote

Just an observation: You have coded:

DCL DFHCOMMAREA CHAR(5) STATIC;

Use of PL/1 STATIC variables is really a "no-no" in CICS. Use of STATIC variables makes the program non-reentrant as STATIC storage are part opf the program itself. Another instance of the task can modify such variables, giving you unexpected results.
Back to top
View user's profile Send private message
ranjini_S01

New User


Joined: 15 Feb 2008
Posts: 12
Location: bangalore

PostPosted: Wed May 28, 2008 2:27 pm    Post subject:
Reply with quote

ok.. then how to declare dfhcommarea? My intention here is to retain data between successive invocations of the transaction. Hence, I declared it as static.
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 990
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Wed May 28, 2008 2:54 pm    Post subject:
Reply with quote

Code:
DCL  MY_COMMAREA   CHAR(5);

EXEC CICS RETURN TRANSID(EIBTRNID) COMMAREA(MY_COMMAREA);


the next iteration of the transaction will have a non-zero EIBCALEN
Back to top
View user's profile Send private message
ranjini_S01

New User


Joined: 15 Feb 2008
Posts: 12
Location: bangalore

PostPosted: Wed May 28, 2008 3:06 pm    Post subject:
Reply with quote

k.. what if I want to process based on commarea contents?

in cobol i will move contents of dfhcommarea to my_commarea and process it. the contents of dfhcommarea s retained between transaction execution.

here how can i fetch the contents of commarea?
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 990
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Wed May 28, 2008 3:37 pm    Post subject:
Reply with quote

For example

Code:
MY_PROG: PROC(COMM_POINTER) OPTIONS(MAIN REENTRANT);
DCL COMM_POINTER POINTER;
DCL  PASSED_COMMAREA CHAR(5) BASED(COMM_POINTER);
DCL  MY_COMMAREA CHAR(5);
IF EIBCALEN > 0
  then do;
    /* Code for 1st time in */
  end;
  else do;
    /* Code for all instances with a passed commarea */
    MY_COMMAREA = PASSED_COMMAREA;
  end;
EXEC CICS RETURN TRANSID(EIBTRNID) COMMAREA(MY_COMMAREA);
END MY_PROG;


The address of the current instance of MY_COMMAREA is passed as a parameter to the next iteration of the transaction. The started transaction then has EIBCALEN > 0 and moves the data from the passed area to the program variable.
Back to top
View user's profile Send private message
ranjini_S01

New User


Joined: 15 Feb 2008
Posts: 12
Location: bangalore

PostPosted: Thu May 29, 2008 2:49 pm    Post subject:
Reply with quote

Thanks a lot!!

I have made the suggested changes. Even then i am getting abend code of 4038.

When the transaction is executed, the map is sent to the terminal for the first time and then the control is returned.

When I enter the data and press ENTER, the transaction gets abended.

Kindly suggest me the solution.
Is it related to compiler options?
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 990
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Thu May 29, 2008 3:51 pm    Post subject:
Reply with quote

Abend 4038 is a generic abend. Have you checked CEEMSG/PLIMSG in the CICS region output for any diagnostic info? you may need to close the TD queue to see messages.

OK, looking back at your earlier posted code, there are a few other things I'd change:

You shouldn't CALL RETURN_CTRL. This implies an expected return after the call which is not what happens. Instead, have RETURN_CTRL as a label in the program, not as a PROC and GOTO RETURN_CTRL.

Your code to call EXIT_PGM should also be a GOTO and is incomplete. The last thing you have to do when exiting a CICS program is EXEC CICS RETURN. In this case, have EXIT_PGM as another label and add EXEC CICS RETURN after the EXEC CICS SEND CONTROL ERASE.

You also have no action taken where SQLCODE ¬= 0. If you get a bad return from DB2, then you exit PROCESS_PROC and go nowhere, you don't even return control to CICS. You should have an EXEC CICS RETURN of some form executed here.

Have you stepped through the transaction in EDF?
Back to top
View user's profile Send private message
ranjini_S01

New User


Joined: 15 Feb 2008
Posts: 12
Location: bangalore

PostPosted: Tue Jun 17, 2008 3:18 pm    Post subject:
Reply with quote

thank you. the program is executing fine.

can we use CALL statement in the program?

When i use a CALL statement, the program gets abended with abend code ASRA
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 990
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Tue Jun 17, 2008 4:18 pm    Post subject:
Reply with quote

PL/1 CALL statement can be used to call an internal procedure or a program declared as EXTERNAL ENTRY. Any EXTERNAL ENTRY program must be linkedited into the load module i.e. you can't do dynamic CALL in PL/1-CICS (AFAIK)

Garry.
Back to top
View user's profile Send private message
ranjini_S01

New User


Joined: 15 Feb 2008
Posts: 12
Location: bangalore

PostPosted: Tue Jun 17, 2008 5:00 pm    Post subject:
Reply with quote

Thanks.

Cant we use package concept in PL/1 CICS program.(declaring procedures in a package).

If yes, what should be the package statement?
{ I am getting the error:

DFHENTRY_C28EB4DB_B964C360 is declared as BASED on the
ADDR of DFHEI0, but DFHENTRY_C28EB4DB_B964C360
requires more storage than DFHEI0.

when i use package statement in the above program}
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 990
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Tue Jun 17, 2008 5:09 pm    Post subject:
Reply with quote

Sorry, don't understand your use of "package" - I'm not familiar with that.

The error message you are getting is because you have two declarations and the overlaid BASED entry extends beyond the end of the field/structure on which it is based. What declares DFHENTRY_C28EB4DB_B964C360 ?

Garry.
Back to top
View user's profile Send private message
ranjini_S01

New User


Joined: 15 Feb 2008
Posts: 12
Location: bangalore

PostPosted: Tue Jun 17, 2008 5:22 pm    Post subject:
Reply with quote

my understanding of package:

a) I can group proedures within a package and i can then control the visibility of procedures outside package (i.e., i can expose only few procedures to be allowed to call from other programs)
eg:

mypack:package;
/* declaration of global variables which are available to all procs */

proc1: proc;
....
end proc1;

proc2:proc;
....
end proc2;
.....

end mypack;

I can control visibility of procs using exports option on package statement.

My intention of pressing for package is that i can declare global variables which i can use in all level-1 procedures(external porcedures)

Regarding to the error, the statement is inserted by the translator after translation (replacement of EXEC CICS statement).

If I use the package, I get the error or else the compilation of the program is fine.

Kindly suggest a solution.
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 -> PL/I & Assembler All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts CICS START AND CANCEL blayek CICS 1 Wed Dec 07, 2016 3:27 am
No new posts How does a called pgm know if its cal... Graeme Westerman COBOL Programming 4 Tue Nov 29, 2016 9:25 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts CICS NEW SIT PARAMETERS CICS BEHAVIOR... Kyle Carroll CICS 0 Fri Nov 04, 2016 11:55 pm
No new posts Single COPY CICS TS datasets and when... Kyle Carroll CICS 2 Tue Oct 11, 2016 9:47 pm


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