ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

CL variable substring

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • CL variable substring

    Dear ALl,
    i have a problem in my CL pgm

    having this entry parameter for the cl program

    PGM PARM(&PRM)
    DCL VAR(&PRM) TYPE(*CHAR) LEN(10)

    i am sending this parameter as C0001
    i want to do smthin inside the cl to have a variable that includes this parameter without the first character
    that means i want another variable which stores the value 0001
    how can this be done,we can have a substring inside a cl?

    Thanks in advance
    have a nice day

  • #2
    Re: CL variable substring

    Here's one way:
    Code:
    PGM PARM(&PRM) 
    DCL VAR(&PRM) TYPE(*CHAR) LEN(10) 
    DCL VAR(&PRMTrimmed) TYPE(*CHAR) LEN(9)
    CHGVAR     VAR(&PRMTrimmed) VALUE(%SST(&PRM 2 9))
    Here's another way:
    Code:
    PGM 
    DCL &PRM *CHAR 10 
    DCL &PRMChar *CHAR 1 STG(*DEFINED) DEFVAR(&PRM) 
    DCL &PRMTrimmed *CHAR 9 STG(*DEFINED) DEFVAR(&PRM 2)
    Last edited by kitvb1; January 20, 2009, 01:47 AM.
    Regards

    Kit
    http://www.ecofitonline.com
    DeskfIT - ChangefIT - XrefIT
    ___________________________________
    There are only 3 kinds of people -
    Those that can count and those that can't.

    Comment


    • #3
      Re: CL variable substring

      OH THANKS ALOT THAT'S WHAT I WANTED
      ONE MORE QUEST
      HOW CNA I CALL THIS CL FROM AN RPG PROGRAM?

      tHANKS ALOT

      Comment


      • #4
        Re: CL variable substring

        For a prototyped call:
        Code:
        /free
         in999c(PRM)
        /end-free
        or
        C                   CallP     IN999c(PRM)
        otherwise
        Code:
        C                   Call      'IN999C'                      
        C                   Parm                    PRM
        Regards

        Kit
        http://www.ecofitonline.com
        DeskfIT - ChangefIT - XrefIT
        ___________________________________
        There are only 3 kinds of people -
        Those that can count and those that can't.

        Comment


        • #5
          Re: CL variable substring

          Thanks alot

          Comment

          Working...
          X