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

Rexx passing mixed case


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Thu Mar 18, 2010 6:59 pm
Reply with quote

I am passing variables between several external programs and my variables are being converted to upper case.

Here is the calling program:

Code:
DISPLAY_SCREEN:
  CALL DRAW_PARMS
  CALL SCRNDSPL PARMS
RETURN

DRAW_PARMS:
  PARMS = ''

  ADDRESS TSO
  "ALLOC DATASET(CURR_PDS("SCRNGLBL")') FILE(PARM) SHR"
  'EXECIO * DISKR PARM (FINIS STEM PARMS.'
  'FREE FILE(PARM)'

  DO I = 1 TO PARMS.0
    PARM = SPACE(SUBSTR(PARMS.I,1,12))

    IF PARM > '' THEN
      INTERPRET "PARMS = PARMS PARM'='"PARM
  END
RETURN


Called program:

Code:
ARG PARMS
CALL PARSE_PARMS PARMS

PARSE_PARMS:
  PARMS = ARG(1)

  DO FOREVER
    IF PARMS > '' THEN DO
      PARSE VAR PARMS PARM PARMS
      PARSE VAR PARM PARM_NAME '=' PARM_VAL .
      INTERPRET PARM_NAME "='"PARM_VAL"'"
    END
    ELSE
      LEAVE
  END
RETURN


If I add a trace entry at the top of the called program, I immediately see the contents of the variables converted to uppercase. I noticed when I return back to the calling program, and parse the RESULT variable, the mixed case is retained. It appears that it is only the ARG function that converts the case. I would understand if I specified 'PARSE UPPER ARG', but I am not.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Mar 18, 2010 7:05 pm
Reply with quote

Yes, that happened to me too once.
I solved it in the following way :

Code:

Substitute:
 
   Arg lit value
 
   Parse Arg value value /* this is to keep mixed case */

Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Thu Mar 18, 2010 7:27 pm
Reply with quote

Thanks Peter, but I am not sure what this is doing. What is the purpose of 'lit' and how does 'PARSE ARG VALUE VALUE' retain mixed case?
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Mar 18, 2010 7:34 pm
Reply with quote

Valyk,

"lit" is the first parameter and "value" the second.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Thu Mar 18, 2010 7:41 pm
Reply with quote

valyk wrote:
It appears that it is only the ARG function that converts the case. I would understand if I specified 'PARSE UPPER ARG', but I am not.


ARG is equivelent to PARSE UPPER ARG

3.2 ARG

Quote:

ARG retrieves the argument strings provided to a program or internal routine and assigns them to variables. It is a short form of the instruction:

Code:
   >>__PARSE UPPER ARG_ _______________ _;__><
                       |_template_list_|


Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Thu Mar 18, 2010 7:44 pm
Reply with quote

Well, I understand that. But, I want to keep my passed variables in the the single variable PARMS. Then parse the variable into many variables (PARM). As soon as I perform the 'ARG PARMS' statement, the contents are immediately converted to uppercase.

Here is a trace example:

First the call statement of the calling program:

Code:
   803 *-*         CALL SCRNDSPL PARMS
       >V>           " BMS_PDS=BC.TS00.ENVUNIT.OMAP CPY_PDS=BC.TS00.ENVUNIT.COP
YLIB SCREEN=DFH0MDEL MAPATTS=CHPV FLD_CNT=79 FLD_CHAR=X ATTR_CNT=14 FLD_CD=1 FL
D_TYP=2 FLD_POS=3 FLD_LEN=4 FLD_LLEN=5 FLD_VAL=6 FLD_NAME=7 FLD_PROT=8 FLD_INTS
=9 FLD_HILT=10 FLD_COLR=11 FLD_PICI=12 FLD_PICO=13 FLD_DFLT=14 RPT.0=3 RPT.1=0
RPT.2=1 RPT.3=1 MAX_ROW=24 MAX_COL=80 INIT_CSR=R8C21 PNL_PREF=SCRN PNL_SUFF=MOD
2 FLD.1=R1C3 R1C3.1=DFH0001 R1C3.2=FD R1C3.3=1,3 R1C3.4=5 R1C3.5=5 R1C3.6=XXXXX
 R1C3.7=DELFFLD R1C3.8=UNPROT R1C3.9=BRT R1C3.10=OFF R1C3.11=NEUTRAL R1C3.12=X(
5) R1C3.13=X(5) R1C3.14=:File FLD.2=R1C9 R1C9.1=DFH0002 R1C9.2=FD R1C9.3=1,9 R1
C9.4=5 R1C9.5=5 R1C9.6=XXXXX R1C9.7=DELHFLD R1C9.8=UNPROT R1C9.9=BRT R1C9.10=OF
F R1C9.11=NEUTRAL R1C9.12=X(5) R1C9.13=X(5) R1C9.14=:Help FLD.3=R2C1 R2C1.1=DFH
0002 R2C1.2=TX R2C1.3=2,1 R2C1.4=78 R2C1.5=78 R2C1.6=--------------------------
---------------------------------------------------- R2C1.7=-------------------
----------------------------------------------------------- R2C1.8=ASKIP R2C1.9
=NORM R2C1.10=OFF R2C1.11=BLUE R2C1.12=X(5) R2C1.13=X(5) R2C1.14=--------------
---------------------------------------------------------------- FLD.4=R3C2 R3C
2.1=DFH0003 R3C2.2=FD R3C2.3=3,2 R3C2.4=4 R3C2.5=4 R3C2.6=XXXX R3C2.7=DELID R3C
2.8=PROT R3C2.9=NORM R3C2.10=OFF R3C2.11=BLUE R3C2.12=X(4) R3C2.13=X(4) R3C2.14
=DEL0 FLD.5=R3C30 R3C30.1=DFH0004 R3C30.2=FD R3C30.3=3,30 R3C30.4=23 R3C30.5=23
 R3C30.6=XXXXXXXXXXXXXXXXXXXXXXX R3C30.7=DELTITL R3C30.8=ASKIP R3C30.9=NORM R3C
30.10=OFF R3C30.11=BLUE R3C30.12=X(23) R3C30.13=X(23) R3C30.14=Delete:Customer
FLD.6=R6C2 R6C2.1=DFH0004 R6C2.2=TX R6C2.3=6,2 R6C2.4=4 R6C2.5=4 R6C2.6=Type R6
C2.7=Type R6C2.8=ASKIP R6C2.9=BRT R6C2.10=OFF R6C2.11=GREEN R6C2.12= R6C2.13= R


Now the first instruction in the called program, ARG PARMS:

Code:
    22 *-* ARG PARMS
       >>>   " BMS_PDS=BC.TS00.ENVUNIT.OMAP CPY_PDS=BC.TS00.ENVUNIT.COPYLIB SCR
EEN=DFH0MDEL MAPATTS=CHPV FLD_CNT=79 FLD_CHAR=X ATTR_CNT=14 FLD_CD=1 FLD_TYP=2
FLD_POS=3 FLD_LEN=4 FLD_LLEN=5 FLD_VAL=6 FLD_NAME=7 FLD_PROT=8 FLD_INTS=9 FLD_H
ILT=10 FLD_COLR=11 FLD_PICI=12 FLD_PICO=13 FLD_DFLT=14 RPT.0=3 RPT.1=0 RPT.2=1
RPT.3=1 MAX_ROW=24 MAX_COL=80 INIT_CSR=R8C21 PNL_PREF=SCRN PNL_SUFF=MOD2 FLD.1=
R1C3 R1C3.1=DFH0001 R1C3.2=FD R1C3.3=1,3 R1C3.4=5 R1C3.5=5 R1C3.6=XXXXX R1C3.7=
DELFFLD R1C3.8=UNPROT R1C3.9=BRT R1C3.10=OFF R1C3.11=NEUTRAL R1C3.12=X(5) R1C3.
13=X(5) R1C3.14=:FILE FLD.2=R1C9 R1C9.1=DFH0002 R1C9.2=FD R1C9.3=1,9 R1C9.4=5 R
1C9.5=5 R1C9.6=XXXXX R1C9.7=DELHFLD R1C9.8=UNPROT R1C9.9=BRT R1C9.10=OFF R1C9.1
1=NEUTRAL R1C9.12=X(5) R1C9.13=X(5) R1C9.14=:HELP FLD.3=R2C1 R2C1.1=DFH0002 R2C
1.2=TX R2C1.3=2,1 R2C1.4=78 R2C1.5=78 R2C1.6=----------------------------------
-------------------------------------------- R2C1.7=---------------------------
--------------------------------------------------- R2C1.8=ASKIP R2C1.9=NORM R2
C1.10=OFF R2C1.11=BLUE R2C1.12=X(5) R2C1.13=X(5) R2C1.14=----------------------
-------------------------------------------------------- FLD.4=R3C2 R3C2.1=DFH0
003 R3C2.2=FD R3C2.3=3,2 R3C2.4=4 R3C2.5=4 R3C2.6=XXXX R3C2.7=DELID R3C2.8=PROT
 R3C2.9=NORM R3C2.10=OFF R3C2.11=BLUE R3C2.12=X(4) R3C2.13=X(4) R3C2.14=DEL0 FL
D.5=R3C30 R3C30.1=DFH0004 R3C30.2=FD R3C30.3=3,30 R3C30.4=23 R3C30.5=23 R3C30.6
=XXXXXXXXXXXXXXXXXXXXXXX R3C30.7=DELTITL R3C30.8=ASKIP R3C30.9=NORM R3C30.10=OF
F R3C30.11=BLUE R3C30.12=X(23) R3C30.13=X(23) R3C30.14=DELETE:CUSTOMER FLD.6=R6
C2 R6C2.1=DFH0004 R6C2.2=TX R6C2.3=6,2 R6C2.4=4 R6C2.5=4 R6C2.6=TYPE R6C2.7=TYP
E R6C2.8=ASKIP R6C2.9=BRT R6C2.10=OFF R6C2.11=GREEN R6C2.12= R6C2.13= R6C2.14=T


Notice the stem variable R3C30.14. The call passes 'Delete:Customer', but it is recieved as 'DELETE:CUSTOMER'
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Thu Mar 18, 2010 7:47 pm
Reply with quote

superk wrote:
valyk wrote:
It appears that it is only the ARG function that converts the case. I would understand if I specified 'PARSE UPPER ARG', but I am not.


ARG is equivelent to PARSE UPPER ARG

3.2 ARG

Quote:

ARG retrieves the argument strings provided to a program or internal routine and assigns them to variables. It is a short form of the instruction:

Code:
   >>__PARSE UPPER ARG_ _______________ _;__><
                       |_template_list_|




Ah, that's the problem. I change 'ARG PARMS' to 'PARSE ARG PARMS' and it fixed the issue. I wonder why IBM defaults that function to behave like that?
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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
Search our Forums:

Back to Top