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

Implement pseudo-conversation in PL/I with CICS


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri May 23, 2008 1:20 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri May 23, 2008 3:26 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri May 23, 2008 4:10 pm
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
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

Moderator Emeritus


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

PostPosted: Mon May 26, 2008 7:50 pm
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

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Wed May 28, 2008 2:19 pm
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
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

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Wed May 28, 2008 2:54 pm
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
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

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Wed May 28, 2008 3:37 pm
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
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

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Thu May 29, 2008 3:51 pm
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
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

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Tue Jun 17, 2008 4:18 pm
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
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

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Tue Jun 17, 2008 5:09 pm
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
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
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Wed Jun 18, 2008 1:11 pm
Reply with quote

I don't quite see what you want to achieve. Use of Global Variables is contrary to CICs re-entrancy requirements.

Also, as stated, you need to link the external program into the calling program, so what benefit is there to exposing/concealing procedures?

I have never found a need to use packages, so I'm afraid I can't be of more help.

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

New User


Joined: 15 Feb 2008
Posts: 12
Location: bangalore

PostPosted: Wed Jun 18, 2008 1:27 pm
Reply with quote

ok.. Thanks.

What is the equivalent of LOW-VALUES in PL/I?

Usually in programs, before sending a BMS map to a terminal, LOW-VALUES are passed to the output fields(Eg: MOVE LOW-VALUES TO MAPO)

What is its equivalent in PL/I?
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Wed Jun 18, 2008 1:33 pm
Reply with quote

Tne PL/1 Builtin Function LOW

e.g.
Code:
 DCL LOW   BUILTIN;
 /* initialise in declare */
 DCL  MY_FIELD     CHAR(10) INIT(LOW(10));

 DCL  YOUR_FIELD  CHAR(5);
/* assignment in code */
 YOUR_FIELD = LOW(5);



BTW the HIGH builtin function sets all bits in a field 'on', the opposite of LOW.

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

New User


Joined: 15 Feb 2008
Posts: 12
Location: bangalore

PostPosted: Wed Jun 18, 2008 2:58 pm
Reply with quote

Thanks.
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 -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts Calling an Open C library function in... CICS 1
No new posts How to 'Ping' a CICS region in JCL CICS 2
No new posts Parallelization in CICS to reduce res... CICS 4
No new posts How to avoid duplicating a CICS Web S... CICS 0
Search our Forums:

Back to Top