CL400 parameters

25 pts.
Tags:
AS/400
AS/400 Parameters
CL/400
hi, i would like to know how to copy a physical file and its corresponding logical file from one library to another by and these four paramaters &filnam,&fromlib,&tolib,&status should be used ?

Software/Hardware used:
os400
ASKED: September 29, 2011  2:03 PM
UPDATED: March 31, 2012  1:00 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 9  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Srfnhmd1
    Please let me know with an example code????
    25 pointsBadges:
    report
  • philpl1jb
    I think you would 1. use CRTDUPOBJ to create the physhical file in the new library 2. use DSPDBR to find the logical files to an outfile 3. use CRTDUPOBJ to create the logicals. Phil
    48,545 pointsBadges:
    report
  • CharlieBrowne
    When you do the CRTDUPOBJ for the logicals, be sure to have the new library at the beginning of your library list. One standard many companies use is to use the same name for the PF and LF with just haveing a different suffix Something like myfilePF myfileLF myfileLFx If you do something like this, you can set you rlibrary list and then do CRTDUPOBJ myfile* *LIBL *FILE newlibrary This will do all with one instruction
    39,780 pointsBadges:
    report
  • philpl1jb
    Now it's time for you to write some code. Send us issues, questions, etc.
    48,545 pointsBadges:
    report
  • Srfnhmd1
    *************** Beginning of data *************************************** PGM PARM(&FILNAM &FROMLIB &TOLIB &STATUS) DCL VAR(&FILNAM) TYPE(*CHAR) LEN(10) DCL VAR(&FROMLIB) TYPE(*CHAR) LEN(10) DCL VAR(&TOLIB) TYPE(*CHAR) LEN(10) DCL VAR(&STATUS) TYPE(*CHAR) LEN(1) DCL VAR(&NEWNAM) TYPE(*CHAR) LEN(10) VALUE(PF001) DCL VAR(&IR) TYPE(*CHAR) LEN(3) DCLF FILE(PF001) /*===================================================================*/ /* CHECK PARAMATERS */ /*===================================================================*/ FILNAM: IF COND(&FILNAM *EQ ' ') THEN(DO) SNDMSG MSG('ERROR NO FILNAME') TOUSR(*REQUESTER) GOTO CMDLBL(END) ENDDO FROMLIB: IF COND(&FROMLIB *EQ ' ') THEN(CHGVAR + VAR(&FROMLIB) VALUE('*LIBL')) CHKOBJ: RTVOBJD OBJ(&FILNAM/&FROMLIB) OBJTYPE(*LIB) MONMSG MSGID(CPF0000) EXEC(DO) SNDMSG MSG('INVALID OBJ NAME') TOUSR(*REQUESTER) GOTO CMDLBL(END) ENDDO TOLIB: IF COND(&TOLIB *EQ ' ') THEN(DO) SNDMSG MSG('TOLIB IS EMPTY') TOUSR(*REQUESTER) GOTO CMDLBL(END) ENDDO RTVOBJD OBJ(&TOLIB) OBJTYPE(*LIB) MONMSG MSGID(CPF0000) EXEC(DO) SNDMSG MSG('TOLIB IS INVALID') TOUSR(*REQUESTER) GOTO CMDLBL(END) ENDDO CHGVAR VAR(&NEWNAM) VALUE(%SST(&FILNAM 1 8) + *TCAT '*') CHKOBJ OBJ(&TOLIB/&NEWNAM) OBJTYPE(*FILE) MONMSG MSGID(CPF0000) EXEC(DO) SNDMSG MSG('OBJ NOT FOUND') TOUSR(*REQUESTER) GOTO CMDLBL(END) ENDDO STATUS: IF COND(&STATUS *EQ 'Y') THEN(CHGVAR + VAR(&STATUS) VALUE('*YES')) ELSE DO IF COND(&STATUS *EQ 'N') THEN(CHGVAR + VAR(&STATUS) VALUE('*NO')) ENDDO NEXT: RCVF MONMSG CPF0864 EXEC(GOTO END) RTVMBRD FILE(&FROMLIB/&FILNAM) FILEATR(&IR) IF COND(&IR *EQ *PF) THEN(DO) CPYF FROMFILE(&FROMLIB/&FILNAM) + TOFILE(&TOLIB/&NEWNAM) FROMMBR(*ALL) + TOMBR(*FROMMBR) MBROPT(*REPLACE) + CRTFILE(*YES) CRTDUPOBJ OBJ(&FILNAM) FROMLIB(&FROMLIB) OBJTYPE(*ALL) + TOLIB(&TOLIB) NEWOBJ(&NEWNAM) ENDDO GOTO CMDLBL(NEXT) END: ENDPGM (In the above pgm i have written for copying for *pf alone but , its not workin. suggest if any code change is required)
    25 pointsBadges:
    report
  • philpl1jb
    Doesn't work??? Please be specific.What is in the job log? If the CPYF works, the CRTDUPOBJ is unnecessary and will throw an error. Phil
    48,545 pointsBadges:
    report
  • CharlieBrowne
    Get rid of the CRTDUPOBJ as it has no value after th eCPYF. The only thing I see is if the FROMFILE is a multimbr file and TOFILE already exist and is not a multimbr file, you will fail. If that is not it, you need to check the joblog
    39,780 pointsBadges:
    report
  • TomLiotta
    RTVOBJD OBJ(&FILNAM/&FROMLIB) OBJTYPE(*LIB)
    I would expect that statement to result in a ’INVALID OBJ NAME’ message almost every time. Tom
    125,585 pointsBadges:
    report
  • Srfnhmd1
    [...] 9. Can you give some insight into CL/400 parameters? [...]
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following