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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Cobol/CICS program

Status
Not open for further replies.

cobolwannabe

Programmer
Jun 4, 2001
1
US
I need help with a program
I have a part of the project working already I will be using micro-focus in
a
mainframe evironment to compile & run the program the program is for a CICS
class
that I am currently taking.
The next phase of the program will


1. Transfer control from the menu to the inquiry program. The user will
select
business function "1" to affect the transfer. At a time, the inquiry program
will
display an initial screen with a message, and/or process the return to the
menu
screen when appropriate PF key is used.

This is the decision matrix for the program

if the requesting program is inqpgm1
receive the map & continue processing

edit the flight # field for valid numeric entry
if valid
place the character "x" in all alpha map fields, & or place a "9"
format date & time fields with appropriate separators.

display and informational message indicating that the users request will be
processed

if the entry is in error
display an appropriate error message set color & atrributes for flight
message in
accordance with standards for error processing

send map inq01m
return control to CICS with Transid "inq1"

if the requestion program is menupgm
send initialized map inq01m
return control to CICS with transid "inq1"

if the requesting program is any value not already specified transfer
control to program

menupgm transid menu using dfhcomarea length of 30 requestion program name

inqpgm1

transfer contral to program menupgm, trans-id menu using the dfhcomarea
length of 30

redisplay a fresh map

send the error message invalid key selected try again

return control to CICS with transid inq1


Below is the part of the program that already works

IDENTIFICATION DIVISION.
PROGRAM-ID. MENU.
******************************************************
** LAB 3
**
**
** THE PROGRAM WILL DISPLAY A MENU & LET THE USER MAKE A
** SELECTION FORM THE MENU OPTIONS 1-4
******************************************************
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WORKING-STORAGE-START.
05 FILLER PIC X(27)
VALUE 'WORKING STORAGE STARTS HERE'.
01 END-OF-SESSION-MSG PIC X(13) VALUE 'YOUR ARE DONE'.
01 ENTER-ERROR-MSG PIC X(45)
VALUE 'INVALID ACTION SELECTED,CORRECT AND TRY AGAIN'.
01 FUNCTN-ERROR-MSG PIC X(36)
VALUE 'INVALID KEY PRESSED PLEASE TRY AGAIN'.
01 CORRECT-MSG PIC X(46)
VALUE 'YOUR SELECTION HAS BEEN SUCCESSFULLY PROCESSED'.
01 COMMUNICATION-AREA.
05 WS-REQ-PGM PIC X(8) VALUE SPACES.
05 WS-FLT-NBR PIC X(04) VALUE SPACES.
05 WS-FILLER PIC X(18) VALUE SPACES.

COPY MENUMAP.
COPY DFHAID.
COPY ATTR.

01 WORKING-STORAGE-STOP.
05 FILLER PIC X(27)
VALUE 'WORKING STORAGE STOPS HERE'.


LINKAGE SECTION.
01 DFHCOMMAREA.
05 LS-REQ-PGM PIC X(8) VALUE SPACES.
05 LS-FLT-NBR PIC X(04) VALUE SPACES.
05 LS-FILLER PIC X(18) VALUE SPACES.


PROCEDURE DIVISION.
***********************************************
** start the process, evaluate what type of
** interrupt has occured and direct the processing
** flow accordingly.
** once all processing has occured, return to CICS
** using your transid and dfhcommarea.
***********************************************
0000-MAINLINE.
EVALUATE TRUE
WHEN EIBCALEN = ZERO
MOVE LOW-VALUE TO MENU01MO
PERFORM 8000-SEND-MAP-WITH-RETURN

WHEN LS-REQ-PGM = 'MENUPGM'
PERFORM 0100-EVALUATE-EIB

WHEN LS-REQ-PGM = 'MENUMAP'
* you are returning from someother valid program
* in this system. send the map for this program
PERFORM 8000-SEND-MAP-WITH-RETURN

WHEN OTHER
* you've got some type of error handle it
MOVE LOW-VALUE TO MENU01MI
MOVE ENTER-ERROR-MSG TO ERRMSGO
MOVE ATTR-RED TO ERRMSGC
MOVE ATTR-RED TO CHOICEC
END-EVALUATE.

***********************************************
** you are returning to this program,
** find out what attention identifier key
** was press to start the event.
***********************************************
0100-EVALUATE-EIB.
EVALUATE TRUE
WHEN EIBAID = DFHCLEAR
PERFORM 8000-SEND-MAP-WITH-RETURN
WHEN EIBAID = DFHPF3
PERFORM 9000-SEND-TERMINATION-MESSAGE
WHEN EIBAID = DFHENTER
PERFORM 1000-START-PROCESSING-MAP
WHEN OTHER
MOVE LOW-VALUE TO MENU01MO
MOVE FUNCTN-ERROR-MSG TO ERRMSGO
MOVE -1 TO ERRMSGL
MOVE ATTR-RED TO ERRMSGC
PERFORM 8000-SEND-MAP-WITH-RETURN
END-EVALUATE.

***********************************************
** this is where you would start your editing
** based on the type of processing requested
***********************************************
1000-START-PROCESSING-MAP.
PERFORM 2000-RECEIVE-MAP.
PERFORM 5000-EDIT-DATA.
PERFORM 8000-SEND-MAP-WITH-RETURN.

***********************************************
** recieve the map/mapset into your working
** storage map copy book
***********************************************
2000-RECEIVE-MAP.
EXEC CICS
RECEIVE MAP('MENU01M')
MAPSET('MENUMAP')
INTO(MENU01MI)
END-EXEC.

***********************************************
** this is where you would start your data edits
***********************************************
5000-EDIT-DATA.
EVALUATE CHOICEI
WHEN '1'
MOVE ATTR-YELLOW TO ERRMSGC
MOVE ATTR-GREEN TO CHOICEC
MOVE -1 TO CHOICEL
MOVE CORRECT-MSG TO ERRMSGO
WHEN '2'
MOVE ATTR-YELLOW TO ERRMSGC
MOVE ATTR-GREEN TO CHOICEC
MOVE -1 TO CHOICEL
MOVE CORRECT-MSG TO ERRMSGO
WHEN '3'
MOVE ATTR-YELLOW TO ERRMSGC
MOVE ATTR-GREEN TO CHOICEC
MOVE -1 TO CHOICEL
MOVE CORRECT-MSG TO ERRMSGO
WHEN '4'
MOVE ATTR-YELLOW TO ERRMSGC
MOVE ATTR-GREEN TO CHOICEC
MOVE -1 TO CHOICEL
MOVE CORRECT-MSG TO ERRMSGO
WHEN OTHER
MOVE -1 TO CHOICEL
MOVE ENTER-ERROR-MSG TO ERRMSGO
MOVE ATTR-RED TO CHOICEC
MOVE ATTR-RED TO ERRMSGC
END-EVALUATE.
***********************************************
** send the map/mapset from the output area
** of you copybook.
***********************************************
8000-SEND-MAP-WITH-RETURN.
MOVE 'MENUPGM' TO WS-REQ-PGM

EXEC CICS
SEND MAP('MENU01M')
MAPSET('MENUMAP')
FROM(MENU01MO)
ERASE
CURSOR
END-EXEC.

EXEC CICS
RETURN TRANSID('MENU')
COMMAREA(COMMUNICATION-AREA)
LENGTH(30)
END-EXEC.


***********************************************
** clear the screen and send a sign off message
** that you build in working storage
** return control to the system
***********************************************
9000-SEND-TERMINATION-MESSAGE.
EXEC CICS
SEND TEXT FROM(END-OF-SESSION-MSG)
ERASE
FREEKB
LENGTH(13)
END-EXEC.

EXEC CICS
RETURN
END-EXEC.


****** END OF PROGRAM *************************


 
Just wanted to know if there were any great online references for cobol that you may know about.

Thanks,

wjlaffin@hotmail.com
 
I read your post but couldn't figure out what your question was.

I may be able to help by blowing the dudst off of my CICS book at home.
 
Hi C,

It's best to come to the table w/a problem. Have you tested your code up to this point?
How did it go? If you had no probs, then you may be confused as to what to do next. Or you've tried something and it's not working. Or you want to proceed but you have questions. Whatever they are let us know, then maybe we can proceed from there.

Regards, Jack.
 
I do mostly CICS. Good CICS references are hard to find. But IBM puts out a couple of them. But really, the only way to learn CICS is to do it, lotsa, lotsa, lotsa times.

Are you having problems with an XCTL? Are there certain places, certain PF keys in this program where you want to XCTL somewhere else?

I know that frequently, a PF3 means that you XCTL to the program from where you came. In that case, in your Evaluate-EIB paragraph, you would write WHEN EIBAID = DFHPF3 EXEC CICS XCTL and put in your parameters.

And frequently, programmers will write a re-usable XCTL paragraph. Then in each specific case, they move the program name where you want to XCTL to into a variable such as PGM-NAME and then do a perform on your XCTL paragraph.

Remember, you can also do a LINK to get to some sort of validation or common routine. Then you aren't relinquising control, but you are merely calling the program, then that program returns control to you.

Hope this helps, Nina Too
 
My favorite reference books for mainframe: Mike Murach ( Murach has produced many books for IBM mainframe enviroment. I haven't seen the current crop but in the past, bailed me out more than once.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top