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

How to run ACCEPT statement that takes keyboard input


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

New User


Joined: 28 Aug 2005
Posts: 4

PostPosted: Sun Aug 28, 2005 5:38 am
Reply with quote

I have the following application,
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
****** ***************************** Top of Data ******************************
000001 IDENTIFICATION DIVISION.
000002 PROGRAM-ID. MMATH.
000003 AUTHOR. S ZHAO.
000004 *
000005 *THIS PROGRAM WILL MULTIPLY TWO NUMBERS FROM THE*
000006 *KEYBOARD AND DISPLAY THE RESULT*
000007 *
000008 ENVIRONMENT DIVISION.
000009 CONFIGURATION SECTION.
000010 SPECIAL-NAMES.
000011 CONSOLE IS NAMES-INPUT.
000012 *
000013 DATA DIVISION.
000014 WORKING-STORAGE SECTION.
000015 01 NUM1 PIC 9 VALUE ZEROS.
000016 01 NUM2 PIC 9 VALUE ZEROS.
000017 01 RESULT PIC 99 VALUE ZEROS.
000018 *
000019 PROCEDURE DIVISION.
000020 MULTIPLICATION.
000021 ACCEPT NUM1 FROM NAMES-INPUT.
000022 ACCEPT NUM2 FROM NAMES-INPUT.
000023 MULTIPLY NUM1 BY NUM2 GIVING RESULT.
000024 DISPLAY "RESULT IS = ", RESULT.
000025 STOP RUN.
****** **************************** Bottom of Data ****************************
I want to compile and run it with the following jcl,
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
****** ***************************** Top of Data ******************************
000100 //ACCOUNT2 JOB (ACCOUNT,xxxxx),CLASS=A,MSGLEVEL=(1,1),MSGCLASS=H,
000200 // NOTIFY=ACCOUNT,REGION=6M
000300 //*************************************************************
000400 //* JOB TO COMPILE, LINK, AND RUN COBOL FOR OS/390
000700 //*************************************************************
000710 //PROCS JCLLIB ORDER=(COBOL.V3R4.SIGYPROC)
000810 //STEP1 EXEC PROC=IGYWCLG
000900 //COBOL.SYSIN DD DSN=ACCOUNT.CLASS.COBOL(MATH),DISP=SHR
000902 //*************************************************************
000910 //LKED.SYSLMOD DD DSN=ACCOUNT.INVEST.LOADLIB(MATH),DISP=SHR
000920 //************************************************************
001110 //GO.SYSOUT DD SYSOUT=*
001120 //
****** **************************** Bottom of Data ****************************
In the Held outpout queue, I kept getting abend code,
09.30.51 JOB01783 IEF450I ACCOUNT2 GO STEP1 - ABEND=S522 U0000 REASON=00000000
*******************************************************************************
A similar jcl works for a simple Cobol that only has DISPLAY statement. Can anyone shed some lights on this problem?
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Sun Aug 28, 2005 10:46 am
Reply with quote

Hi Sherry,

Abend code S522 denotes a TIME OUT.

You can give a try specifying TIME=NOLIMIT in the EXEC statement.

Regards,

Priyesh.
Back to top
View user's profile Send private message
Sherry Zhao

New User


Joined: 28 Aug 2005
Posts: 4

PostPosted: Sun Aug 28, 2005 10:02 pm
Reply with quote

Thanks for your reply, Priyesh. It looks like that the problem is that I do not know how to key in the number input from my 3270 terminal emulator, after the job is submitted. icon_sad.gif Therefore, the job waits for input until it is timed out. Do you have a pointer how to get the input from keyboard to the terminal?
Back to top
View user's profile Send private message
amaruth

New User


Joined: 17 Jul 2005
Posts: 4

PostPosted: Mon Aug 29, 2005 9:03 am
Reply with quote

Hi Sherry,
Have a look at the below code.. i have made a few modifications to ur code...

000001 IDENTIFICATION DIVISION.
000002 PROGRAM-ID. MMATH.
000003 AUTHOR. S ZHAO.
000004 *
000005 *THIS PROGRAM WILL MULTIPLY TWO NUMBERS FROM THE*
000006 *KEYBOARD AND DISPLAY THE RESULT*
000007 *
000008 ENVIRONMENT DIVISION.
000013 DATA DIVISION.
000014 WORKING-STORAGE SECTION.
000015 01 NUM1 PIC 9 VALUE ZEROS.
000016 01 NUM2 PIC 9 VALUE ZEROS.
000017 01 RESULT PIC 99 VALUE ZEROS.
000018 *
000019 PROCEDURE DIVISION.
000020 MULTIPLICATION.
000021 ACCEPT NUM1
000022 ACCEPT NUM2
000023 MULTIPLY NUM1 BY NUM2 GIVING RESULT.
000024 DISPLAY "RESULT IS = ", RESULT.
000025 STOP RUN.
****** **************************** Bottom of Data ****************************
I hope that this will solve your problem...
Back to top
View user's profile Send private message
amaruth

New User


Joined: 17 Jul 2005
Posts: 4

PostPosted: Mon Aug 29, 2005 9:26 am
Reply with quote

OOps.. sorry .. i got it wrong.. my solution was for getting values from JCL sysin statement icon_sad.gif
Back to top
View user's profile Send private message
Kevin

Active User


Joined: 25 Aug 2005
Posts: 234

PostPosted: Mon Aug 29, 2005 9:08 pm
Reply with quote

Sherry, since you have created a job and submitted your program to the background for batch processing, it is now interfacing with MVS and JES. Programs running in batch can accept input from the MVS console. This process is known as a WTOR, or Write-To-Operator with Reply.

You must code your DISPLAY statements so that they DISPLAY UPON CONSOLE, and your ACCEPT statements so that they ACCEPT FROM CONSOLE.

Once your job has been submitted, you will need to access the master console. On the console you will see a message from your program something like this (if you don't see this, issue the MVS command 'D R,L' to show all outstanding replies):

- 11.33.55 JOB12345 +MY MESSAGE
@11.33.55 JOB12345 @40 IGZ0000I AWAITING REPLY

where +MY MESSAGE is the output of your DISPLAY statement, and @40 is the pending reply number. Enter your response by first giving the reply number, a comma, and then your reply, thus:

40,MY REPLY
Back to top
View user's profile Send private message
Sherry Zhao

New User


Joined: 28 Aug 2005
Posts: 4

PostPosted: Tue Aug 30, 2005 5:20 am
Reply with quote

Thanks for the tips, Kevin. In sdsf panel, the Input queue, I see the following message.

18.20.05 JOB03626 +INPUT PLEASE
18.20.05 JOB03626 @69 IGZ0000I AWAITING REPLY

It looks like that the I/O does get directed to the console. However, I have two numbers that need to be keyed in. But when I entered

69,3,4

I got error "invalid command". I also tried 69,3. does not work either. Any suggestion?
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 419
Location: Inside the SPEW (Southwest Ohio, USA)

PostPosted: Tue Aug 30, 2005 7:42 am
Reply with quote

for each ACCEPT you would get a console message

you would have to reply to each as they appear on the console


Dave
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 TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts force tablespace using LISTDEF input DB2 1
No new posts Two input files & writing counter... DFSORT/ICETOOL 12
No new posts Use input file with OMIT rcd keys? DFSORT/ICETOOL 15
Search our Forums:

Back to Top