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
 

 

Pass a parameter to Pgm. Cobol(DB2) from CLIST

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Celia Barossi

New User


Joined: 28 Nov 2005
Posts: 1

PostPosted: Mon Nov 28, 2005 9:47 pm    Post subject: Pass a parameter to Pgm. Cobol(DB2) from CLIST
Reply with quote

I need to verify that is necessary to insert on program Cobol at linkage section any characters of control, before my parameters.
I'm trying to call a program with parameters by clist, and I saw that parameters are wrong, when it are displayed.

--PGM
Code:

  LINKAGE SECTION.                                                       
  01           WE000-LINKAGE       PIC X(00020).                         
  01           WE000-LINKAGE-R     REDEFINES     WE000-LINKAGE.         
      05       WE000-INPUT-PARMS.
       10      WE000-ANO           PIC X(00004).                         
       10      WE000-TMA           PIC X(00004).                         
       10      WE000-IMC           PIC X(00003).                         
      05       WE000-OUTPUT-PARMS.                                       
       10      WE000-MESSAGENO     PIC X(00006).                         
       10      FILLER              PIC X(00003).                         


-- CLIST
Code:

WRITE ### CHAMADA DO SUBPGM ###                                                 
DSN  SYSTEM(DB2B)                                                               
RUN  PROGRAM(WE000C00) LIB('AXG.LOAD')  +                                       
     PARMS('2005ABC WWWAAAAAAFFF')                                             
END                                                                             
WRITE ### RETORNO DO SUBPGM ###                                                 
END                                                                             


-- CLIST EXECUTION

### CHAMADA DO SUBPGM ###
DSN SYSTEM(DB2B)
RUN PROGRAM(WE000C00) LIB('AXG.LOAD') PARMS('2005ABC WWWAAAAAAFFF')
***--- VOU INICIALIZAR O PROGRAMA ---***
:20 / 05AB / C W
**ERRO***
**WE000-MESSAGENO 999993
### RETORNO DO SUBPGM ###
END
***
icon_question.gif icon_question.gif icon_question.gif
Back to top
View user's profile Send private message

John_Deal

New User


Joined: 28 Nov 2005
Posts: 4
Location: Montgomery, AL, USA

PostPosted: Mon Nov 28, 2005 11:49 pm    Post subject:
Reply with quote

You forgot the 4 bytes that are used for the LENGTH of the linkage section... Try adding 4 bytes to the front of your linkage section... icon_smile.gif
icon_cool.gif
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Thu Dec 01, 2005 4:42 am    Post subject: Re: Pass a parameter to Pgm. Cobol(DB2) from CLIST
Reply with quote

The Length of the string is two bytes, not four. Define as PIC 999 COMP

From the COBOL Reference
Quote:

Specify run-time options in the PARM parameter of the EXEC statement that
starts execution. Code the PARM parameter as follows:

PARM='[user-parameter][/execution-options]'

user-parameter
Parameter to be passed to the VS COBOL II program being executed.
This parameter is then accessed by a USING phrase in your application
program.

If the user-parameter in the list contains a slash, add a trailing
slash. All data following this second slash is considered to be COBOL
run-time options. The last slash and the data following it are passed
to the program when the data following the last slash does not contain
any valid COBOL run-time options. In this case, the entire PARM
parameter is passed to the program and the COBOL run-time message
IGZ019I is sent. If there are no run-time options, failure to add the
trailing slash will cause the user-parameter data to the right of the
last slash to be treated (erroneously) as run-time options.

The Linkage Section record (level-01) that is to receive the
user-parameter data passed by the PARM string must be defined, taking
into account the halfword length field inserted in front of the string
by the system.
The program can test this field length for nonzero, to verify that
PARM-string data has in fact been passed. For example:

LINKAGE SECTION.
01 PARMDATA.
05 STRINGLEN PIC 999 USAGE COMP.
05 STRINGPARM PIC X(6).
PROCEDURE DIVISION USING PARMDATA.
IF STRINGLEN > 0 . . .
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm
No new posts COBOL Programming Sandpit? jodrisco COBOL Programming 6 Wed Apr 12, 2017 3:47 am


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