CL variable change - IBM AS400

This is a discussion on CL variable change - IBM AS400 ; Hi. My CL program need to get 2 variables from other application. Application pass variables (&JPRF and &JDSN) looks like '111' and '111111'. My CL should get 111 and 111111. Can I cut variables before my CL gets them (remove ...

+ Reply to Thread
Results 1 to 10 of 10

Thread: CL variable change

  1. CL variable change

    Hi.

    My CL program need to get 2 variables from other application.
    Application pass variables (&JPRF and &JDSN) looks like '111' and
    '111111'. My CL should get 111 and 111111. Can I cut variables before
    my CL gets them (remove ' ') ? Or perhaps can I write CL to be able to
    get variables with '...'.

    My program looks like:
    PGM PARM(&JPRF &JDSN)
    DCL VAR(&JPRF) TYPE(*DEC) LEN(3)
    DCL VAR(&JDSN) TYPE(*DEC) LEN(6)
    CALL PGM(QP2SHELL) +
    PARM('/USR/LOCAL/ZEND/CORE/BIN/PHP-CLI' '/WWW/ZENDCORE/HTDOCS/
    ASTEST2.PHP' &JPRF &JDSN)
    ENDPGM

    Regards,
    Tomasz


  2. Re: CL variable change

    tomasz schreef:
    > Hi.
    >
    > My CL program need to get 2 variables from other application.
    > Application pass variables (&JPRF and &JDSN) looks like '111' and
    > '111111'. My CL should get 111 and 111111. Can I cut variables before
    > my CL gets them (remove ' ') ? Or perhaps can I write CL to be able to
    > get variables with '...'.
    >
    > My program looks like:
    > PGM PARM(&JPRF &JDSN)
    > DCL VAR(&JPRF) TYPE(*DEC) LEN(3)
    > DCL VAR(&JDSN) TYPE(*DEC) LEN(6)
    > CALL PGM(QP2SHELL) +
    > PARM('/USR/LOCAL/ZEND/CORE/BIN/PHP-CLI' '/WWW/ZENDCORE/HTDOCS/
    > ASTEST2.PHP' &JPRF &JDSN)
    > ENDPGM
    >
    > Regards,
    > Tomasz
    >

    I am not sure whether I understand your question exactly.



    1. Accept alfanumeric parameters
    Define the parameters as type *CHAR and use the CHGVAR command to
    convert the alfa parameters to numeric fields.

    PGM PARM(&JPRFA &JDSNA)
    DCL VAR(&JPRFA) TYPE(*CHAR) LEN(3)
    DCL VAR(&JDSNA) TYPE(*CHAR) LEN(6)
    DCL VAR(&JPRF) TYPE(*DEC) LEN(3 0)
    DCL VAR(&JDSN) TYPE(*DEC) LEN(6 0)

    CHGVAR VAR(&JPRF) VALUE(&JPRFA)
    CHGVAR VAR(&JDSN) VALUE(&JDSNA)

    I think variables in CL defined as *DEC are packed. I do not know
    whether PHP accepts packed fields. I run PHP on unix and always pass
    variables as alfa.

    I am not sure I understood your question, if I did not, forget what I said.


    Kind regads

    Ben Thijssen
    The Netherlands.

  3. Re: CL variable change

    Hi.
    All I need is to make my CL to accept variables like '111' '11111'.
    At the moment it only gets 111 111111.
    Sorry for my not clear mail.


    Regards,
    Tomasz



    reader napisał(a):
    > tomasz schreef:
    >> Hi.
    >>
    >> My CL program need to get 2 variables from other application.
    >> Application pass variables (&JPRF and &JDSN) looks like '111' and
    >> '111111'. My CL should get 111 and 111111. Can I cut variables before
    >> my CL gets them (remove ' ') ? Or perhaps can I write CL to be able to
    >> get variables with '...'.
    >>
    >> My program looks like:
    >> PGM PARM(&JPRF &JDSN)
    >> DCL VAR(&JPRF) TYPE(*DEC) LEN(3)
    >> DCL VAR(&JDSN) TYPE(*DEC) LEN(6)
    >> CALL PGM(QP2SHELL) +
    >> PARM('/USR/LOCAL/ZEND/CORE/BIN/PHP-CLI' '/WWW/ZENDCORE/HTDOCS/
    >> ASTEST2.PHP' &JPRF &JDSN)
    >> ENDPGM
    >>
    >> Regards,
    >> Tomasz
    >>

    > I am not sure whether I understand your question exactly.
    >
    >
    >
    > 1. Accept alfanumeric parameters
    > Define the parameters as type *CHAR and use the CHGVAR command to
    > convert the alfa parameters to numeric fields.
    >
    > PGM PARM(&JPRFA &JDSNA)
    > DCL VAR(&JPRFA) TYPE(*CHAR) LEN(3)
    > DCL VAR(&JDSNA) TYPE(*CHAR) LEN(6)
    > DCL VAR(&JPRF) TYPE(*DEC) LEN(3 0)
    > DCL VAR(&JDSN) TYPE(*DEC) LEN(6 0)
    >
    > CHGVAR VAR(&JPRF) VALUE(&JPRFA)
    > CHGVAR VAR(&JDSN) VALUE(&JDSNA)
    >
    > I think variables in CL defined as *DEC are packed. I do not know
    > whether PHP accepts packed fields. I run PHP on unix and always pass
    > variables as alfa.
    >
    > I am not sure I understood your question, if I did not, forget what I said.
    >
    >
    > Kind regads
    >
    > Ben Thijssen
    > The Netherlands.


  4. Re: CL variable change

    On May 22, 11:44 am, tomasz wrote:
    > Hi.
    >
    > My CL program need to get 2 variables from other application.
    > Application pass variables (&JPRF and &JDSN) looks like '111' and
    > '111111'. My CL should get 111 and 111111. Can I cut variables before
    > my CL gets them (remove ' ') ? Or perhaps can I write CL to be able to
    > get variables with '...'.
    >
    > My program looks like:
    > PGM PARM(&JPRF &JDSN)
    > DCL VAR(&JPRF) TYPE(*DEC) LEN(3)
    > DCL VAR(&JDSN) TYPE(*DEC) LEN(6)
    > CALL PGM(QP2SHELL) +
    > PARM('/USR/LOCAL/ZEND/CORE/BIN/PHP-CLI' '/WWW/ZENDCORE/HTDOCS/
    > ASTEST2.PHP' &JPRF &JDSN)
    > ENDPGM
    >
    > Regards,
    > Tomasz


    Make your parameters character instead of decimal and then pass
    character parameters????
    DCL VAR(&JPRF) TYPE(*CHAR) LEN(3)
    DCL VAR(&JDSN) TYPE(*CHAR) LEN(6)


  5. Re: CL variable change

    I'm confused about what you actually want...

    If you want quotes at the beginning and end of the parameter variable then
    you need to pass them in as character, and to get '111' you will need a 5
    position parameter field. Depending on how you are calling your CL, it may,
    or may not, be difficult to generate such a character field.

    If, instead, you want to pass a 5-character field as the 2nd parm to QSHELL
    then you could do it this way:
    DCL &JPRFA *CHAR 5
    CHGVAR &JPRFA &JPRF
    CHGVAR &JPRFA '''' *CAT &JPRFA *TCAT ''''
    and pass &JPRFA to QSHELL.

    In the above '''' is four quotes in a row. Basically, it is converting
    decimal to character, then adding a quote at the beginning and end.

    Sam

    "tomasz" wrote in message
    news:f2vjkv$p2p$1@nemesis.news.tpi.pl...
    > Hi.
    > All I need is to make my CL to accept variables like '111' '11111'.
    > At the moment it only gets 111 111111.
    > Sorry for my not clear mail.
    >
    >
    > Regards,
    > Tomasz
    >
    >
    >
    > reader napisal(a):
    >> tomasz schreef:
    >>> Hi.
    >>>
    >>> My CL program need to get 2 variables from other application.
    >>> Application pass variables (&JPRF and &JDSN) looks like '111' and
    >>> '111111'. My CL should get 111 and 111111. Can I cut variables before
    >>> my CL gets them (remove ' ') ? Or perhaps can I write CL to be able to
    >>> get variables with '...'.
    >>>
    >>> My program looks like:
    >>> PGM PARM(&JPRF &JDSN)
    >>> DCL VAR(&JPRF) TYPE(*DEC) LEN(3)
    >>> DCL VAR(&JDSN) TYPE(*DEC) LEN(6)
    >>> CALL PGM(QP2SHELL) +
    >>> PARM('/USR/LOCAL/ZEND/CORE/BIN/PHP-CLI' '/WWW/ZENDCORE/HTDOCS/
    >>> ASTEST2.PHP' &JPRF &JDSN)
    >>> ENDPGM
    >>>
    >>> Regards,
    >>> Tomasz
    >>>

    >> I am not sure whether I understand your question exactly.
    >>
    >>
    >>
    >> 1. Accept alfanumeric parameters
    >> Define the parameters as type *CHAR and use the CHGVAR command to
    >> convert the alfa parameters to numeric fields.
    >>
    >> PGM PARM(&JPRFA &JDSNA)
    >> DCL VAR(&JPRFA) TYPE(*CHAR) LEN(3)
    >> DCL VAR(&JDSNA) TYPE(*CHAR) LEN(6)
    >> DCL VAR(&JPRF) TYPE(*DEC) LEN(3 0)
    >> DCL VAR(&JDSN) TYPE(*DEC) LEN(6 0)
    >>
    >> CHGVAR VAR(&JPRF) VALUE(&JPRFA)
    >> CHGVAR VAR(&JDSN) VALUE(&JDSNA)
    >>
    >> I think variables in CL defined as *DEC are packed. I do not know
    >> whether PHP accepts packed fields. I run PHP on unix and always pass
    >> variables as alfa.
    >>
    >> I am not sure I understood your question, if I did not, forget what I
    >> said.
    >>
    >>
    >> Kind regads
    >>
    >> Ben Thijssen
    >> The Netherlands.




  6. Re: CL variable change

    il 22/05/2007 22.21, Scrive tomasz 40695904:
    > Hi.
    > All I need is to make my CL to accept variables like '111' '11111'.
    > At the moment it only gets 111 111111.
    > Sorry for my not clear mail.

    You have to change the data-type of program arguments, like this:
    PGM PARM(&JPRF &JDSN)
    DCL VAR(&JPRF) TYPE(*CHAR) LEN(3)
    DCL VAR(&JDSN) TYPE(*CHAR) LEN(6)
    CALL PGM(QP2SHELL) +
    PARM('/USR/LOCAL/ZEND/CORE/BIN/PHP-CLI' '/WWW/ZENDCORE/HTDOCS/
    ASTEST2.PHP' &JPRF &JDSN)
    ENDPGM


    --
    Dr.Ugo Gagliardelli,Modena,ItalyCertifiedUindoscrasherA˝e joAlcoolInside
    Spaccamaroni andate a cagare/Spammers not welcome/Spammers vŃo Ó merda
    Spamers iros a la mierda/Spamers allez vous faire foutre/Spammers loop
    schijten/Spammers macht Euch vom Acker/Spamerzy wypierdalac'

  7. Re: CL variable change

    Hi.

    My CL looks like this:
    PGM PARM(&JPRF &JDSN)
    DCL VAR(&JPRF) TYPE(*DEC) LEN(3)
    DCL VAR(&JDSN) TYPE(*DEC) LEN(6)
    CALL PGM(QP2SHELL) +
    PARM('/USR/LOCAL/ZEND/CORE/BIN/PHP-CLI' +
    '/WWW/ZENDCORE/HTDOCS/ASTEST3.PHP' &JPRF &JDSN)
    ENDPGM

    After I execute it by CALL MYLIB/CALLPHP3 PARM('111' '111111') it should
    show me a message: EXECUTED FOR 111/111111, and if I run this PHP on PC
    by php -f astest3 111 111111 it works fine.

    In future it should be run from other application which gives my CL
    variables &JPRF and &JDSN look like '111' '111111', so my CL should
    accept them.

    Perhaps I do something wrong with variables passing to CL?

    Regards,
    Tomasz


    Dr.UgoGagliardelli napisał(a):
    > il 22/05/2007 22.21, Scrive tomasz 40695904:
    >> Hi.
    >> All I need is to make my CL to accept variables like '111' '11111'.
    >> At the moment it only gets 111 111111.
    >> Sorry for my not clear mail.

    > You have to change the data-type of program arguments, like this:
    > PGM PARM(&JPRF &JDSN)
    > DCL VAR(&JPRF) TYPE(*CHAR) LEN(3)
    > DCL VAR(&JDSN) TYPE(*CHAR) LEN(6)
    > CALL PGM(QP2SHELL) +
    > PARM('/USR/LOCAL/ZEND/CORE/BIN/PHP-CLI' '/WWW/ZENDCORE/HTDOCS/
    > ASTEST2.PHP' &JPRF &JDSN)
    > ENDPGM
    >
    >


  8. Re: CL variable change

    il 23/05/2007 10.11, Scrive tomasz 40695904:
    > Hi.
    >
    > My CL looks like this:
    > PGM PARM(&JPRF &JDSN)
    > DCL VAR(&JPRF) TYPE(*DEC) LEN(3)
    > DCL VAR(&JDSN) TYPE(*DEC) LEN(6)
    > CALL PGM(QP2SHELL) +
    > PARM('/USR/LOCAL/ZEND/CORE/BIN/PHP-CLI' +
    > '/WWW/ZENDCORE/HTDOCS/ASTEST3.PHP' &JPRF &JDSN)
    > ENDPGM
    >
    > After I execute it by CALL MYLIB/CALLPHP3 PARM('111' '111111') it should
    > show me a message: EXECUTED FOR 111/111111, and if I run this PHP on PC
    > by php -f astest3 111 111111 it works fine.


    If you call qp2shell directy, does it work?
    e.g.
    CALL PGM(QP2SHELL) PARM('/USR/LOCAL/ZEND/CORE/BIN/PHP-CLI'
    '/WWW/ZENDCORE/HTDOCS/' '111' '111111')

    directly from the as command line.
    If you launch your php from the pase terminal, does it work?
    e.g
    enter the command CALL QP2TERM from the as command line, then

    /USR/LOCAL/ZEND/CORE/BIN/PHP-CLI /WWW/ZENDCORE/HTDOCS/ 111 111111

    from the pase command line.

    Be aware that pase file-system is case sensitive.

    >
    > In future it should be run from other application which gives my CL
    > variables &JPRF and &JDSN look like '111' '111111', so my CL should
    > accept them.
    >
    > Perhaps I do something wrong with variables passing to CL?
    >
    > Regards,
    > Tomasz
    >
    >
    > Dr.UgoGagliardelli napisał(a):
    >> il 22/05/2007 22.21, Scrive tomasz 40695904:
    >>> Hi.
    >>> All I need is to make my CL to accept variables like '111' '11111'.
    >>> At the moment it only gets 111 111111.
    >>> Sorry for my not clear mail.

    >> You have to change the data-type of program arguments, like this:
    >> PGM PARM(&JPRF &JDSN)
    >> DCL VAR(&JPRF) TYPE(*CHAR) LEN(3)
    >> DCL VAR(&JDSN) TYPE(*CHAR) LEN(6)
    >> CALL PGM(QP2SHELL) +
    >> PARM('/USR/LOCAL/ZEND/CORE/BIN/PHP-CLI' '/WWW/ZENDCORE/HTDOCS/
    >> ASTEST2.PHP' &JPRF &JDSN)
    >> ENDPGM
    >>
    >>



    --
    Dr.Ugo Gagliardelli,Modena,ItalyCertifiedUindoscrasherA˝e joAlcoolInside
    Spaccamaroni andate a cagare/Spammers not welcome/Spammers vŃo Ó merda
    Spamers iros a la mierda/Spamers allez vous faire foutre/Spammers loop
    schijten/Spammers macht Euch vom Acker/Spamerzy wypierdalac'

  9. Re: CL variable change

    Hi.

    I've started it from command line:
    CALL PGM(QP2SHELL) PARM('/USR/LOCAL/ZEND/CORE/BIN/PHP-CLI'
    '/WWW/ZENDCORE/HTDOCS/astest3.php' '111' '111111')

    and then from PASE:
    /USR/LOCAL/ZEND/CORE/BIN/PHP-CLI /WWW/ZENDCORE/HTDOCS/astest3.php 111 111111

    in both situations it worked fine (showed me a message EXECUTED FOR
    111/111111).

    now I need to run it by CL procedure with 2 parameters '111' '111111',
    at the moment I get message like this:

    EXECUTED FOR 111 111111
    /111111
    Press ENTER to end terminal session.

    should be:
    EXECUTED FOR 111/111111
    Press ENTER to end terminal session.

    Regards,
    Tomasz


    Dr.UgoGagliardelli napisał(a):
    > il 23/05/2007 10.11, Scrive tomasz 40695904:
    >> Hi.
    >>
    >> My CL looks like this:
    >> PGM PARM(&JPRF &JDSN)
    >> DCL VAR(&JPRF) TYPE(*DEC) LEN(3)
    >> DCL VAR(&JDSN) TYPE(*DEC) LEN(6)
    >> CALL PGM(QP2SHELL) +
    >> PARM('/USR/LOCAL/ZEND/CORE/BIN/PHP-CLI' +
    >> '/WWW/ZENDCORE/HTDOCS/ASTEST3.PHP' &JPRF &JDSN)
    >> ENDPGM
    >>
    >> After I execute it by CALL MYLIB/CALLPHP3 PARM('111' '111111') it should
    >> show me a message: EXECUTED FOR 111/111111, and if I run this PHP on
    >> PC by php -f astest3 111 111111 it works fine.

    >
    > If you call qp2shell directy, does it work?
    > e.g.
    > CALL PGM(QP2SHELL) PARM('/USR/LOCAL/ZEND/CORE/BIN/PHP-CLI'
    > '/WWW/ZENDCORE/HTDOCS/' '111' '111111')
    >
    > directly from the as command line.
    > If you launch your php from the pase terminal, does it work?
    > e.g
    > enter the command CALL QP2TERM from the as command line, then
    >
    > /USR/LOCAL/ZEND/CORE/BIN/PHP-CLI /WWW/ZENDCORE/HTDOCS/ 111 111111
    >
    > from the pase command line.
    >
    > Be aware that pase file-system is case sensitive.
    >
    >>
    >> In future it should be run from other application which gives my CL
    >> variables &JPRF and &JDSN look like '111' '111111', so my CL should
    >> accept them.
    >>
    >> Perhaps I do something wrong with variables passing to CL?
    >>
    >> Regards,
    >> Tomasz
    >>
    >>
    >> Dr.UgoGagliardelli napisa├ůÔÇÜ(a):
    >>> il 22/05/2007 22.21, Scrive tomasz 40695904:
    >>>> Hi.
    >>>> All I need is to make my CL to accept variables like '111' '11111'.
    >>>> At the moment it only gets 111 111111.
    >>>> Sorry for my not clear mail.
    >>> You have to change the data-type of program arguments, like this:
    >>> PGM PARM(&JPRF &JDSN)
    >>> DCL VAR(&JPRF) TYPE(*CHAR) LEN(3)
    >>> DCL VAR(&JDSN) TYPE(*CHAR) LEN(6)
    >>> CALL PGM(QP2SHELL) +
    >>> PARM('/USR/LOCAL/ZEND/CORE/BIN/PHP-CLI' '/WWW/ZENDCORE/HTDOCS/
    >>> ASTEST2.PHP' &JPRF &JDSN)
    >>> ENDPGM
    >>>
    >>>

    >
    >


  10. Re: CL variable change

    tomasz wrote:

    > My CL program need to get 2 variables from other application.
    > Application pass variables (&JPRF and &JDSN) looks like '111' and
    > '111111'. My CL should get 111 and 111111. Can I cut variables before
    > my CL gets them (remove ' ') ? Or perhaps can I write CL to be able to
    > get variables with '...'.
    >
    > My program looks like:
    > PGM PARM(&JPRF &JDSN)
    > DCL VAR(&JPRF) TYPE(*DEC) LEN(3)
    > DCL VAR(&JDSN) TYPE(*DEC) LEN(6)
    > CALL PGM(QP2SHELL) +
    > PARM('/USR/LOCAL/ZEND/CORE/BIN/PHP-CLI' '/WWW/ZENDCORE/HTDOCS/
    > ASTEST2.PHP' &JPRF &JDSN)
    > ENDPGM


    Tomasz:

    If you are still having this problem, please test this change:

    > PGM PARM(&JPRF &JDSN)
    > DCL VAR(&JPRF) TYPE(*DEC) LEN(3)
    > DCL VAR(&JDSN) TYPE(*DEC) LEN(6)

    dmpclpgm
    > CALL PGM(QP2SHELL) +
    > PARM('/USR/LOCAL/ZEND/CORE/BIN/PHP-CLI' '/WWW/ZENDCORE/HTDOCS/
    > ASTEST2.PHP' &JPRF &JDSN)
    > ENDPGM


    After the dump is produced, please show us what the program has in those
    values.

    This will tell us exactly what is arriving in the CL program, and might
    help determine how it should be changed.

    Also, please clarify if this is OPM CL or ILE CL, and what version of
    OS/400 or i5/OS.

    --
    Tom Liotta
    http://zap.to/tl400

+ Reply to Thread