List of library objects into CLP

Tags:
AS/400
CLP
RSTLIB
I need to create a program. This program will must copy files for the back up. I mean, before RSTLIB (for restore 10-15 files from savf into library) command all same objects in library must be copied to the special library for back up objects. Please help me.
0

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.

Discuss This Question: 7  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.
  • TheRealRaven
    What are you having trouble with? What have you tried? Show your current work, please, and describe the actual problem.
    35,660 pointsBadges:
    report
  • Motorbreath
    I'd tried to convert spool file
    DSPSAVF FILE(TSTSAVF1)  OUTPUT(*PRINT)  
    into PF file and then Declare that file in the CLP PGM, but don't know how then i could use names of files, because there is some useless information for me like

    Save file  . . . . . . . . . . . . . . :
      Library  . . . . . . . . . . . . . . :
      Records  . . . . . . . . . . . . . . :
    Save operation:                         
      Save command . . . . . . . . . . . . :
      Save date/time . . . . . . . . . . . :
      Save while active  . . . . . . . . . :
      Data compressed  . . . . . . . . . . :
      Release level  . . . . . . . . . . . :

                            
    and after that Savf objects.

     Object       Type
    TSTSAVF      *LIB
    TSTPGM1      *PGM   
    TSTPGM2     *PGM
    TSTPGM3     *PGM



    70 pointsBadges:
    report
  • pdraebel
    When you declare the file with the copied spool in it and you read a record it will read the whole line (132 chars) as one field. You will need to extract from that line portions into CL variables. Upon the value in those variables you will have to define your actions.
    DCL &OBJECT *CHAR 10
    CHGVAR &OBJECT value(%SST(&line 2 10)
    After variable &OBJECT has the value 'Object' your list of objects will follow.
    7,545 pointsBadges:
    report
  • ToddN2000
    A little more info please. Are you looking only to restore some of the file from the SAVF? What defines the objects for the SAVF? You may be able to use some of the code from the SAVF to do the restore.
    133,790 pointsBadges:
    report
  • Motorbreath
    Ok, for example.

    i have the library MAINPGM
    objects in lib:
    TSTPGM1
    TSTPGM2
    TSTPGM3
    TSTPGM4
    TSTPGM5
    TSTPGM6
    TSTPGM7
    TSTPGM8
    TSTPGM8
    ......
    TSTPGMN


    and every week i have 1 savf with new PGMs with names
    for example:
    TSTPGM4
    TSTPGM5
    TSTPGM6
    TSTPGM60
    TSTPGM95
    TSTPF25


    that is prototype of programs so before i will complete the restore i need to create back up of old PGMs.

    i may have a 200+ of PF and PGM in savf and i need to define which of them already in my MAINPGM library, and before restore i need to move or copy them into BACKUP labrary with same names with description "*old description* + dd/mm/y''

    70 pointsBadges:
    report
  • ToddN2000
    Lets see if I am following correct.

    1. your main  (production) lib is like MAINLIB

    2. You have a SAVF ( where is this coming from, a TEST environment perhaps ?) .

    3. You want to restore the objects in the SAVF to MAINLIB.

    4. If it currently exist in MAINLIB you want to copy or move the old object to another location before it's restored.

    When you create the SAVF, how do you determine what to include? You could create a work file to hold the new object names then use this to to the move/copy before the restore is done.
    133,790 pointsBadges:
    report
  • pdraebel
    I would construct a CL variable to hold all the Objects + Object Types from the Input save file. Object = *CHAR 10 Object type = *CHAR 10.
    Once that is done go through the variable (with SUBSTR) to move the objects existing in MAINLIB out of the lib (to some other lib).
    If you want to save the old objects remember you can have an object list of max 300 objects. To execute the save command you will have to use QCMDEXC and construct the Save command in the command variable.
    7,545 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.

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

Following

Share this item with your network: