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
 

 

how to accept the comp iems in procedure division.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
purushoth_jp

New User


Joined: 12 Dec 2004
Posts: 22

PostPosted: Sun Dec 19, 2004 1:38 pm    Post subject: how to accept the comp iems in procedure division.
Reply with quote

hi all

how to accept the comp iems in procedure division.

eg

data division.
working-storage section.
77 empno pic s9(4) comp.

procedure division.
main-para

accept empno.
insert into emp values (empno).

This is a db2-cobol program in precompliation time it is giving the error like below.

error message is IGYPA3018-S binary integer was used in a accept statement. the statement was discarded.

whether there is any other way to accept the comp items in procedure division and assign it to the insert operation.

reply soon
bye
Back to top
View user's profile Send private message

mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Dec 19, 2004 3:08 pm    Post subject:
Reply with quote

Hi,

It can be done, but it's a bit complicated. Using COMP for an employee number is unusual.

Before I take the time to explainn the process why don't you explain why you're doing it that way? Why not carry it as PIC XXXX like everyone else?
Back to top
View user's profile Send private message
purushoth_jp

New User


Joined: 12 Dec 2004
Posts: 22

PostPosted: Sun Dec 19, 2004 8:59 pm    Post subject:
Reply with quote

hi jack
it is a DB2 cobol program, in which iam inserting values in DB2 through cobol. i have added the DCL member in the program. iam not able to accept that variable through accept statement. in DCL member the Empid is declared as s9(9) comp in DCl member.

ok now tell me how to accept that.


regards
purushoth
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Dec 20, 2004 5:36 am    Post subject:
Reply with quote

OK so I guess you're saying "that's the way they designed it and I'm just following their lead".

I have one other question. If the pgm user wants to add an empid of decimal 26, does (s)he enter 10 or 26 in the SYSIN rec? Just want to make sure we're on the same page.
Back to top
View user's profile Send private message
sharan112

New User


Joined: 21 Dec 2004
Posts: 2

PostPosted: Tue Dec 21, 2004 11:02 am    Post subject: Comp for user interface??!!
Reply with quote

Comp items are for better arithmetic calculation and efficient storage purpose. For user interface (Accepet, Display) you must use the following datatypes "any group item, or an elementary alphabetic, alphanumeric,alphanumeric-edited, numeric-edited"

Use the following code, it should work.

data division.
working-storage section.
77 empno-num pic 9(4).
77 empno-comp pic s9(4) comp.

procedure division.
main-para

accept empno-num.
move empno-num to empno-comp
insert into emp values (empno-comp).
Back to top
View user's profile Send private message
haiardhan

New User


Joined: 26 Jul 2008
Posts: 6
Location: hyderabad

PostPosted: Fri Oct 24, 2008 1:02 am    Post subject:
Reply with quote

IGYPA3018-S
ID DIVISION.
PROGRAM-ID. KANINS.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
EXEC SQL
INCLUDE SQLCA
END-EXEC.
EXEC SQL
INCLUDE KANDCL
END-EXEC.
PROCEDURE DIVISION.
MP.
ACCEPT WS-NAME.
Accept ws-empid.

EXEC SQL
INSERT INTO jpk98.KAN1 (NAME, EMPID)
VALUES (:WS-NAME, :WS-EMPID)

END-EXEC.
STOP RUN.
DCL Gen
=====

EXEC SQL DECLARE JPK98.KAN1 TABLE
( NAME CHAR(20),
EMPID INTEGER
) END-EXEC.
******************************************************************
* COBOL DECLARATION FOR TABLE LEM0U98.KAN1 *
******************************************************************
01 WS-EMP.
* *************************************************************
* NAME
10 WS-NAME PIC X(20).
* *************************************************************
* EMPID
10 WS-EMPID PIC S9(9) USAGE COMP.
******************************************************************
* INDICATOR VARIABLE STRUCTURE *
******************************************************************
01 IKAN1.
10 INDSTRUC PIC S9(4) USAGE COMP OCCURS 2 TIMES.
******************************************************************
* THE NUMBER OF COLUMNS DESCRIBED BY THIS DECLARATION IS 2 *
******************************************************************

error is

116 IGYPA3018-S Identifier "WS-EMPID (BINARY INTEGER)" was used in an "ACCEPT" statement. The statement was discarded.

FOR THE ABOVE PROBLEM
YOU NEED CHANGE THE ACCEPT STATMENT LIKE THIS..............................

ID DIVISION.
PROGRAM-ID. KANINS.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 TEMP-EMPID PIC S9(9) COMP.------........OR 77 TEMP-EMPID PIC S9(9).
EXEC SQL
INCLUDE SQLCA
END-EXEC.
EXEC SQL
INCLUDE KANDCL
END-EXEC.
PROCEDURE DIVISION.
MP.
ACCEPT WS-NAME.
Accept TEMP-empid.
MOVE TEMP-EMPID TO WS-EMPID.
EXEC SQL
INSERT INTO jpk98.KAN1 (NAME, EMPID)
VALUES (:WS-NAME, :WS-EMPID)

END-EXEC.
STOP RUN.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10211
Location: italy

PostPosted: Fri Oct 24, 2008 1:07 am    Post subject: Reply to: how to accept the comp iems in procedure division.
Reply with quote

why resurrect a 4 Year old topic...
also the post is not clear,
looks like it is quoting some program and giving a solution to some error


maybe the post was posted on the wrong topic ???
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 Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Is possible to call subprogram from c... cmsmoon COBOL Programming 3 Fri Aug 05, 2016 6:46 pm


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