MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

data passing from JCL to PL/I pgm using PARM parameter

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
i413678
Beginner


Joined: 28 Jan 2005
Posts: 4
Topics: 3

PostPosted: Fri Jan 28, 2005 3:36 am    Post subject: data passing from JCL to PL/I pgm using PARM parameter Reply with quote

Hi,

I want to pass the data from JCL to PL/I through PARM parameter.

I want to receive the data sent from PARM parameter into more than one variable in PL/I program.

Can any one help.

Advance Thankx.

Regards,
Pavan
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Jan 28, 2005 6:39 am    Post subject: Reply with quote

i413678,

Try this. In this pgm I am trying to pass a 50 byte value via parm and I am moving it to 2 different variables viz.. Ws-var1 and ws-var2

Code:

PLIPGM: PROC(INPARMS) OPTIONS(MAIN) ;

DCL INPARMS                 VAR CHAR(50);
DCL 1 PARMS                 BASED(ADDR(INPARMS)),
       2 PARM_LENGTH        FIXED BINARY(15) INIT(0),
       2 PARM_VAR           CHAR(50);

DCL WS_VAR1                  CHAR(50);
DCL WS_VAR2                  CHAR(50);

  WS_VAR1  = PARM_VAR;
  WS_VAR2  = PARM_VAR;



JCL :

Code:

//STEP0100 EXEC PGM=PLIPGM,PARM='MY PARMS FOR LENGTH OF 50 BYTES'


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
iklingen
Beginner


Joined: 11 Feb 2005
Posts: 5
Topics: 2

PostPosted: Mon Feb 14, 2005 3:19 am    Post subject: Reply with quote

Another variant. You can pass to your program a string with pairs 'my_var1=value1,my_var2=value2,...' and parse it:
Code:

my_prm: proc(param) options(main);
   dcl (param, pair, var, val) char(100) var;
   dcl ind                     fixed(15,0);
   dcl my_var1 ...;
   dcl my_var2 ...;
   ...

   do while( length(param) );
      ind = index( param, ',' );
      if ind = 0 then do;
         pair  = param;
         param = '';
         end;
      else do
         pair = substr( param, 1, ind-1 );
         substr( param, 1, ind ) = '';
      end;

      ind = index( pair, '=' );
      if ind > 0 then do;
         var = lowercase( substr( pair, 1, ind-1 ) );
         val = substr( pair, ind+1 );
         select( var );
            when('my_var1') do; my_var1 = ...val...; end;
            when('my_var2') do; my_var2 = ...val...; end;
            ...
         end;
      end;
   end;

   ....
   
end;


Regards,
Igor
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group