Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

CPYFRMIMPF statement with IFS file name as parm

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

  • CPYFRMIMPF statement with IFS file name as parm

    I'm calling a CL and passing the file name I need to retrieve from the IFS as a parameter.

    CALL PGM(MYPROGS/MYCLPROG) +
    PARM('/ifsdirctory/thisismyfile')

    I can't seem to correctly define the string I need to represent the following statement:

    ** MYPROGS/MYCLPROG

    DCL VAR(&FILEIN) TYPE(*CHAR) LEN(75)
    DCL VAR(&STRING) TYPE(*CHAR) LEN(200)
    DCL VAR(&QUOTE) TYPE(*CHAR) LEN(1)
    /* Here's what the statement should be: */
    CPYFRMIMPF +
    FROMSTMF('/ifsdirctory/thisismyfile') +
    TOFILE(MYLIB/MYFILE) +
    MBROPT(*REPLACE) RCDDLM(*CRLF) +
    ERRRCDOPT(*REPLACE) RPLNULLVAL(*FLDDFT)
    /*********************************************/

    /* here's my latest effort */
    CHGVAR VAR(&QUOTE) VALUE('''')
    CHGVAR VAR(&STRING) VALUE(' ')
    CHGVAR VAR(&STRING) VALUE('FROMSTMF(')
    CHGVAR VAR(&STRING) VALUE(&STRING *CAT &QUOTE *CAT +
    &FILEIN *CAT &QUOTE *CAT ')')
    CHGVAR VAR(&STRING) VALUE(&STRING *TCAT +
    ' TOFILE(BILLIB/EXRUNSUM)' *CAT +
    ' MBROPT(*REPLACE) RCDDLM(*CRLF)')

    /* the result is this: */
    ....5...10...15...20...25...30...35...40...45...50 ...55...60
    1 'FROMSTMF( TOFILE(BILLIB/EXRUNSUM) MBROPT(*REPLACE) RCDDLM(*C'
    61 'RLF)'

    No matter what I do I can't seem to insert the IFS file name including quotes into &STRING.

    Can anyone help? Thanks.

  • #2
    Originally posted by jdlee View Post
    I'm calling a CL and passing the file name I need to retrieve from the IFS as a parameter.

    CALL PGM(MYPROGS/MYCLPROG) +
    PARM('/ifsdirctory/thisismyfile')

    I can't seem to correctly define the string I need to represent the following statement:

    ** MYPROGS/MYCLPROG

    DCL VAR(&FILEIN) TYPE(*CHAR) LEN(75)
    DCL VAR(&STRING) TYPE(*CHAR) LEN(200)
    DCL VAR(&QUOTE) TYPE(*CHAR) LEN(1)
    /* Here's what the statement should be: */
    CPYFRMIMPF +
    FROMSTMF('/ifsdirctory/thisismyfile') +
    TOFILE(MYLIB/MYFILE) +
    MBROPT(*REPLACE) RCDDLM(*CRLF) +
    ERRRCDOPT(*REPLACE) RPLNULLVAL(*FLDDFT)
    /*********************************************/

    /* here's my latest effort */
    CHGVAR VAR(&QUOTE) VALUE('''')
    CHGVAR VAR(&STRING) VALUE(' ')
    CHGVAR VAR(&STRING) VALUE('FROMSTMF(')
    CHGVAR VAR(&STRING) VALUE(&STRING *CAT &QUOTE *CAT +
    &FILEIN *CAT &QUOTE *CAT ')')
    CHGVAR VAR(&STRING) VALUE(&STRING *TCAT +
    ' TOFILE(BILLIB/EXRUNSUM)' *CAT +
    ' MBROPT(*REPLACE) RCDDLM(*CRLF)')

    /* the result is this: */
    ....5...10...15...20...25...30...35...40...45...50 ...55...60
    1 'FROMSTMF( TOFILE(BILLIB/EXRUNSUM) MBROPT(*REPLACE) RCDDLM(*C'
    61 'RLF)'

    No matter what I do I can't seem to insert the IFS file name including quotes into &STRING.

    Can anyone help? Thanks.
    I've got it working. I got so tangled up in my quotes and debugs I got lost.
    The statement should have been:
    CPYFRMIMPF +
    FROMSTMF(&FILEIN) +
    TOFILE(MYLIB/MYFILE) +
    MBROPT(*REPLACE) RCDDLM(*CRLF) +
    ERRRCDOPT(*REPLACE) RPLNULLVAL(*FLDDFT)

    I was thinking I HAD to put quotes around the IFS file name. So simple...

    Comment

    Working...
    X