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

New to DB2- Help me with this simple program


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mjshaheed

New User


Joined: 09 Apr 2007
Posts: 25
Location: Chennai,India

PostPosted: Tue Oct 16, 2007 2:51 pm
Reply with quote

Hi All,

i am very much new to DB2.
I wrote a very simple db2-cob program.
But the Job ends with a return code of 4.
By looking at the JOB and Program below, can anyone of u pls help me?
SYSOUT has been generated by it says,
========================================================================
| Object Resolution Warnings |
========================================================================

WARNING EDC4015: Unresolved references are detected:


And also can anyone of u tell me where i have to check for the return codes?


Thanks & Regards,
Shahul

//TRGG23JB JOB (TRG-TRG-TRGG23-XXX-999),CLASS=C,
// MSGCLASS=X,MSGLEVEL=(1,1),NOTIFY=TRGG23
// JCLLIB ORDER=SYS1T.USER.PROCLIB
//STEP EXEC PROC=DSNHCOB
//PC.SYSIN DD DSN=TRGG23.SAMPLE.PGMS(PROGRAM1),DISP=SHR
//*PC.SYSLIB DD DSN=SAMPLE.DB2DCLG.PDS(ARUN),DISP=SHR
//PC.DBRMLIB DD DSN=TRGG23.TEST.DBRMLIB(PROGRAM1)
//LKED.SYSLMOD DD DSN=TRGG23.TEST.LOAD(PROGRAM1)
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSIN DD DUMMY
/*
//



DATA DIVISION.
WORKING-STORAGE SECTION.
EXEC SQL DECLARE EMPLLL TABLE
( ENO CHAR(03),
ENAME VARCHAR(25),
ESALARY INTEGER)
END-EXEC.
EXEC SQL
INCLUDE SQLCA
END-EXEC.

01 DCLEMP.
( ENO CHAR(03),
ENAME VARCHAR(25),
ESALARY INTEGER)
END-EXEC.

01 DCLEMP.
02 WS-ENO PIC X(03).
02 WS-ENAME PIC X(25).
02 WS-ESALARY PIC S9(09) COMP.

77 WS-TEMP-NO PIC X(03) VALUE SPACE.

PROCEDURE DIVISION.
DISPLAY 'WELCOME TO DB2'.
MOVE '01' TO WS-TEMP-NO.
EXEC SQL
SELECT ENO,ENAME,ESALARY INTO
:WS-ENO,:WS-ENAME,:WS-ESALARY FROM EMPLLL
WHERE ENO = :WS-TEMP-NO
END-EXEC.
IF SQLCODE = 0
DISPLAY 'ENO: ' WS-ENO
DISPLAY 'ENAME: ' WS-ENAME
DISPLAY 'ESAL: ' WS-ESALARY
ELSE
DISPLAY 'THERE IS SOMETHING WRONG WITH THE PROGRAM'.
STOP RUN.
Back to top
View user's profile Send private message
hemanth.nandas

Active User


Joined: 18 Aug 2007
Posts: 120
Location: India

PostPosted: Tue Oct 16, 2007 3:15 pm
Reply with quote

Hi Shaheed,

Quote:
01 DCLEMP.
( ENO CHAR(03),
ENAME VARCHAR(25),
ESALARY INTEGER)
END-EXEC.


Check the syntax here.

Quote:
01 DCLEMP.
02 WS-ENO PIC X(03).
02 WS-ENAME PIC X(25).
02 WS-ESALARY PIC S9(09) COMP.


Here for WS-ENAME PIC X(25) should declare as follows and change the Level number also because Cobol equivalent declaration for DB2 vriables is like this. For more info READ Manuals.

Code:
01 DCLEMP.
     10 WS-ENO PIC X(03).
     10 WS-ENAME.
          49 WS-ENAME-LENGHT PIC S9(4) COMP.
          49 WS-ENAME-TEXT PIC X(25).
      10 WS-ESALARY PIC S9(09) COMP.
Back to top
View user's profile Send private message
hemanth.nandas

Active User


Joined: 18 Aug 2007
Posts: 120
Location: India

PostPosted: Tue Oct 16, 2007 3:28 pm
Reply with quote

Hi Shaheed,

Quote:
EXEC SQL DECLARE EMPLLL TABLE
( ENO CHAR(03),
ENAME VARCHAR(25),
ESALARY INTEGER)
END-EXEC.


Is it Cursor Declaration? Let Us know.
Back to top
View user's profile Send private message
mjshaheed

New User


Joined: 09 Apr 2007
Posts: 25
Location: Chennai,India

PostPosted: Wed Oct 17, 2007 4:03 pm
Reply with quote

No. It's not a cursor declaration. It's only a table declaration, i dont know how to declare it in DCLGEN and use it in the program.

Sorry friend, Actually the working-storage declarations looks like as given below.

WORKING-STORAGE SECTION.
EXEC SQL DECLARE EMPLLL TABLE
( ENO CHAR(03),
ENAME VARCHAR(25),
ESALARY INTEGER)
END-EXEC.
EXEC SQL
INCLUDE SQLCA
END-EXEC.

01 DCLEMP.
02 WS-ENO PIC X(03).
02 WS-ENAME PIC X(25).
02 WS-ESALARY PIC S9(09) COMP.


The table EMPLLL has three fields as follows.

empno - char(03)
ename - varchar(25)
esalary - integer

Please help.
Thanks,
Shaheed
Back to top
View user's profile Send private message
nuthan

Active User


Joined: 26 Sep 2005
Posts: 146
Location: Bangalore

PostPosted: Wed Oct 17, 2007 4:13 pm
Reply with quote

Use the working-storage host varibales as follows:

01 DCLEMP.
10 WS-ENO PIC X(03).
10 WS-ENAME.
49 WS-ENAME-LENGHT PIC S9(4) COMP.
49 WS-ENAME-TEXT PIC X(25).
10 WS-ESALARY PIC S9(09) COMP.

Run the program and let us know.
Back to top
View user's profile Send private message
mjshaheed

New User


Joined: 09 Apr 2007
Posts: 25
Location: Chennai,India

PostPosted: Wed Oct 17, 2007 6:10 pm
Reply with quote

Hi Nuthan,

Even after doing the changes i am getting the same message and the job ends with a return code of 4.


Thanks & Regards,
Shahul
Back to top
View user's profile Send private message
hemanth.nandas

Active User


Joined: 18 Aug 2007
Posts: 120
Location: India

PostPosted: Thu Oct 18, 2007 10:48 am
Reply with quote

Hi Shahul,

Quote:
Even after doing the changes i am getting the same message and the job ends with a return code of 4.


Post JESLOG details here.
Back to top
View user's profile Send private message
mjshaheed

New User


Joined: 09 Apr 2007
Posts: 25
Location: Chennai,India

PostPosted: Thu Oct 18, 2007 5:08 pm
Reply with quote

Hi Hemanth,

I have posted the JCL here.
I think there is something wrong with this JCL.
Please help me. I think it is a standard jcl they use here.

//TRGG23JB JOB (TRG-TRG-TRGG23-XXX-999),CLASS=C,
// MSGCLASS=X,MSGLEVEL=(1,1),NOTIFY=TRGG23

// JCLLIB ORDER=SYS1T.USER.PROCLIB
//STEP EXEC PROC=DSNHCOB
//PC.SYSLIB DD DSN=TRGG23.ARM.BENCH(DCLGEN1),DISP=SHR
//PC.SYSIN DD DSN=TRGG23.SAMPLE.PGMS(PROGRAM1),DISP=SHR
//PC.DBRMLIB DD DSN=TRGG23.TEST.DBRMLIB(PROGRAM1),DISP=SHR
//LKED.SYSLMOD DD DSN=TRGG23.TEST.LOAD(PROGRAM1),DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSIN DD DUMMY
/*
//

Thanks,
Shahul
Back to top
View user's profile Send private message
hemanth.nandas

Active User


Joined: 18 Aug 2007
Posts: 120
Location: India

PostPosted: Thu Oct 18, 2007 5:16 pm
Reply with quote

Hi Shahul,

I asked for SYSOUT JESLOG information (Return code) and Messages you are getting(Full message info as you posted this Object Resolution Warnings)
Back to top
View user's profile Send private message
mjshaheed

New User


Joined: 09 Apr 2007
Posts: 25
Location: Chennai,India

PostPosted: Thu Oct 18, 2007 5:35 pm
Reply with quote

Please see the results i got as follows,

********************************* TOP OF DATA **********************************
========================================================================
| Prelinker Map |
| |
| CPLINK:5694A01 V1 R7 M0 IBM Language Environment 2007/10/18 17:07:22|
========================================================================

Command Options. . . . . : NONCAL NOMEMORY ER DUP MAP
: NOOMVS NOUPCASE DYNAM


========================================================================
| Object Resolution Warnings |
========================================================================

WARNING EDC4015: Unresolved references are detected:
DSNHADDR DSNHADD2 DSNHLI IGZCBSO CEESTART CEEBETBL CEESG005
========================================================================
| File Map |
========================================================================

*ORIGIN FILE ID FILE NAME

P 00001 DD:SYSIN

*ORIGIN: P=primary input PI=primary INCLUDE SI=secondary INCLUDE
A=automatic call R=RENAME card L=C Library
IN=internal


========================================================================
| Writable Static Map |
========================================================================

INFORMATIONAL EDC4013: No map displayed as no writable static was found.
========================================================================
| ESD Map of Defined and Long Names |
========================================================================

OUTPUT
*REASON FILE ID ESD NAME INPUT NAME

00001 PROGRAM1 PROGRAM1

*REASON: P=#pragma or reserved S=matches short name R=RENAME card
L=C Library U=UPCASE option D=Default


============ E N D O F P R E - L I N K A G E M A P =============
******************************** BOTTOM OF DATA *************************


Thanks,
Shahul
Back to top
View user's profile Send private message
hemanth.nandas

Active User


Joined: 18 Aug 2007
Posts: 120
Location: India

PostPosted: Thu Oct 18, 2007 5:54 pm
Reply with quote

Hi Shahul,

Wel, But JCL You're using is not standard one.

Quote:
WARNING EDC4015: Unresolved references are detected:
DSNHADDR DSNHADD2 DSNHLI IGZCBSO CEESTART CEEBETBL CEESG005


This type will get when not included DSN=SYS.SCEERUN in Jcl.
Include It in Your JCL.
Back to top
View user's profile Send private message
hemanth.nandas

Active User


Joined: 18 Aug 2007
Posts: 120
Location: India

PostPosted: Thu Oct 18, 2007 6:07 pm
Reply with quote

Hi Shuhal,

Use it in your Jcl.

//STEPLIB DD DSNAME=SYS1.SCEERUN,DISP=SHR
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top