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

how to accept the comp iems in procedure division.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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
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
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
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: 7
Location: india

PostPosted: Fri Oct 24, 2008 1:02 am
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Fri Oct 24, 2008 1:07 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Invoke stored procedure via batch JCL. DB2 2
No new posts Interviewers are surprised with my an... Mainframe Interview Questions 6
No new posts Calling COBOL DB2 program from a COBO... COBOL Programming 2
Search our Forums:

Back to Top