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
 

 

New to DB2- Help me with this simple program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: New to DB2- Help me with this simple program
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: Chennai

PostPosted: Tue Oct 16, 2007 3:15 pm    Post subject:
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: Chennai

PostPosted: Tue Oct 16, 2007 3:28 pm    Post subject:
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    Post subject: New to DB2- Help me with this simple program
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    Post subject:
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    Post subject: New to DB2- Help me with this simple program
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: Chennai

PostPosted: Thu Oct 18, 2007 10:48 am    Post subject:
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    Post subject: New to DB2- help me with this simple program
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: Chennai

PostPosted: Thu Oct 18, 2007 5:16 pm    Post subject:
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    Post subject: New to DB2- help me with this simple program
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: Chennai

PostPosted: Thu Oct 18, 2007 5:54 pm    Post subject:
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: Chennai

PostPosted: Thu Oct 18, 2007 6:07 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm


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