ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

How to retrieve save-file saved date and time

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

  • How to retrieve save-file saved date and time

    Hi All,

    I want to retrieve save file information like date and time when any save file is saved with information in it.

    We can see this information with following command:-
    dspsavf qgpl/Mysavefile and then use F16=Display header
    In this header we can see saved date and time under heading Save operation.

    How do I do this. Is there any API which will does this???
    Cheers...
    Nil

  • #2
    Re: How to retrieve save-file saved date and time

    try this with format 3



    an example from my second favorite site http://www.think400.dk

    The Work with Save File Objects (WRKSAVFOBJ) Utility
    Robin Klima - 12:01am Nov 1, 1995 PST
    MC Press Online

    Save files are a versatile type of AS/400 object. You can use save
    files to compress and store AS/400 objects and libraries to disk.
    The contents of save files can be saved to offline storage as part
    of a backup strategy. Save files can also be used as containers for
    sending objects over a SNADS network.

    OS/400 provides a number of commands that allow you to interact with
    save files. Surprisingly enough, however, there are no commands in
    the operating system that allow you to "work with" the contents of
    a save file. The closest command is Display Save File (DSPSAVF),
    which only lets you view the contents of a save file. In this article,
    I'll introduce you to a command that overcomes this limitation. The
    Work with Save File Objects (WRKSAVFOBJ) command presents a list of
    objects in a save file and allows you to select objects that you want
    to restore.

    This command is useful because it can save you time when you need to
    restore individual objects from a save file. It accomplishes this by
    combining several steps into one. For example, suppose you want to
    restore some objects from a save file, but you don't know the exact
    names of the objects. Using native OS/400 commands, you need to first
    run the DSPSAVF command, then either write down the names of the
    objects you want to restore or, if you requested a listing, send the
    output to a printer. Finally, you need to return to a command line,
    prompt the Restore Object (RSTOBJ) command, and begin keying object
    names. This can be a time-consuming and possibly error-prone task.

    Given the same scenario, the WRKSAVFOBJ command makes this task much
    easier. You just need to enter the command followed by the name of the
    save file. You are presented with a display showing a list of all of
    the objects in the save file. As you find objects you want to restore,
    you simply select them from the list and press Enter to restore them to
    the system. I'll discuss a number of other features to this command
    shortly, but this gives you the basic idea for the purpose for this
    command.

    As I describe this utility, you'll notice that it has functionality
    similar to many other commands in OS/400. This is because I designed
    this application to use a UIM list panel (see "UIM List Panels," MC,
    July 1994). UIM provides a very consistent user interface that IBM uses
    extensively throughout OS/400. UIM list panels provide functionality
    similar to subfiles, but require much less code. This utility also takes
    advantage of several system application program interfaces (APIs) to
    accomplish its task.

    APIs

    In addition to calling APIs to interact with the list panel, the SAV001RG
    program also calls APIs to retrieve information about the contents of the
    save file. I'll briefly describe all of the APIs used in this program in
    the order in which they are called. Refer to Figure 6 to see the syntax
    of the API calls.

    The List Save File (QSRLSAVF) API loads the user space with information
    about the library that the objects in the save file were saved from.

    The Retrieve User Space (QUSRTVUS) API is called to retrieve the library
    information from the user space.

    The Open Display Application (QUIOPNDA) API opens the SAV001PG panel group.

    The Put Dialog Variable (QUIPUTV) API updates the value of the dialog
    variables in the "header" variable record by passing a buffer containing
    the new values.

    The QSRLSAVF API loads the user space with information about the objects
    in the save file.

    The QUSRTVUS API is called a second time to retrieve the object information
    from the user space.

    The Add List Entry API (QUIADDLE) API adds an entry to the list panel
    (similar to adding a record to a subfile).

    The Display Panel (QUIDSPP) API displays the panel and waits for the user
    to press F3 or F12.

    The Close Application (QUICLOA) API closes the UIM panel group.
    PHP Code:
     /*===============================================================*/
     /* To compile:                                                   */
     /*                                                               */
     /*           CRTCMD     CMD(XXX/WRKSAVFOBJ) PGM(XXX/SAV001CL) +  */
     /*                        SRCFILE(XXX/QCMDSRC)                   */
     /*                                                               */
     /*===============================================================*/
                  
    CMD        PROMPT('Work with Save File Objects')
     
                  
    PARM       KWD(SAVFTYPE(QUALMIN(1PROMPT('Save file')
     
                  
    PARM       KWD(OBJTYPE(*GENERICDFT(*ALL) +
                               
    SPCVAL((*ALL)) PROMPT('Object')
     
                  
    PARM       KWD(OBJTYPTYPE(*CHARLEN(10RSTD(*YES) +
                               
    DFT(*ALLVALUES(*ALRTBL *BNDDIR *CFGL +
                               *
    CHTFMT *CLD *CLS *CMD *CRQD *CSI *CSPMAP +
                               *
    CSPTBL *DTAARA *DTAQ *EDTD *EXITRG *FCT +
                               *
    FILE *FNTRSC *FORMDF *FTR *GSS *JOBD +
                               *
    JOBQ *JOBSCD *JRN *JRNRCV *MENU *MODULE +
                               *
    MSGF *MSGQ *NODL *OUTQ *OVL *PAGDFN +
                               *
    PAGSEG *PDG *PGM *PNLGRP *PRDAVL *PRDDFN +
                               *
    PRDLOD *QMFORM *QMQRY *QRYDFN *RCT *SBSD +
                               *
    SCHIDX *SPADCT *SQLPKG *SRVPGM *SSND +
                               *
    SVRSTG *S36 *TBL *USRIDX *USRQ *USRSPC +
                               *
    WSCSTSPCVAL((*ALL)) PROMPT('Object type')
     
      
    QUAL:       QUAL       TYPE(*NAMELEN(10)
                  
    QUAL       TYPE(*NAMELEN(10DFT(*LIBL) +
                               
    SPCVAL((*LIBL)) PROMPT('Library'
    PHP Code:
     /*===============================================================*/
     /* To compile:                                                   */
     /*                                                               */
     /*           CRTCLPGM   PGM(XXX/SAV001CL) SRCFILE(XXX/QCLSRC)    */
     /*                                                               */
     /*===============================================================*/
                  
    PGM        PARM(&SAVF &OBJ &OBJTYP)
     
                  
    DCL        VAR(&SAVFTYPE(*CHARLEN(20)
                  
    DCL        VAR(&OBJTYPE(*CHARLEN(10)
                  
    DCL        VAR(&OBJTYPTYPE(*CHARLEN(10)
                  
    DCL        VAR(&OBJATRTYPE(*CHARLEN(10)
                  
    DCL        VAR(&RTNLIBTYPE(*CHARLEN(10)
                  
    DCL        VAR(&ERRDTATYPE(*CHARLEN(10)
                  
    DCL        VAR(&MSGIDTYPE(*CHARLEN(7)
                  
    DCL        VAR(&MSGDTATYPE(*CHARLEN(80)
     
                  
    /* Send all errors to error handling routine */
                  
    MONMSG     MSGID(CPF0000EXEC(GOTO CMDLBL(ERROR))
     
                  
    /* Don't allow this command to be called recursively */
                  
    SNDPGMMSG  MSG(' 'TOPGMQ(*SAME (SAV001RG))
                  
    MONMSG     MSGID(CPF2469EXEC(GOTO CMDLBL(CONTINUE))
                  
    RMVMSG     PGMQ(*SAME (SAV001RG)) CLEAR(*ALL)
                  
    SNDPGMMSG  MSGID(CPF9898MSGF(QCPFMSGMSGDTA('Command +
                               WRKSAVFOBJ already in use within this +
                               job'
    MSGTYPE(*ESCAPE)
     
                  
    /* Check to be sure file exists */
      
    CONTINUE:   CHKOBJ     OBJ(%SST(&SAVF 11 10)/%SST(&SAVF 1 10)) +
                               
    OBJTYPE(*FILE)
     
                  
    /* Check to be sure file is a save file */
                  
    RTVOBJD    OBJ(%SST(&SAVF 11 10)/%SST(&SAVF 1 10)) +
                               
    OBJTYPE(*FILERTNLIB(&RTNLIB) +
                               
    OBJATR(&OBJATR)
                  IF         
    COND(&OBJATR *NE 'SAVF'THEN(SNDPGMMSG +
                               
    MSGID(CPF3782MSGF(QCPFMSG) +
                               
    MSGDTA(&SAVFMSGTYPE(*ESCAPE))
                  
    CHGVAR     VAR(%SST(&SAVF 11 10)) VALUE(&RTNLIB)
     
                  
    /* Re-create the user space */
                  
    DLTUSRSPC  USRSPC(QTEMP/SAV001US)
                  
    MONMSG     MSGID(CPF0000)
                  
    CALL       PGM(QUSCRTUSPARM('SAV001US  QTEMP' '' +
                               
    100000 '' '*ALL' '')
     
                  
    /* Call program to display save file information */
                  
    CALL       PGM(SAV001RGPARM(&SAVF &OBJ &OBJTYP &ERRDTA)
                  IF         
    COND(&ERRDTA *EQ '*EMPTY'THEN(SNDPGMMSG +
                               
    MSGID(CPF3707MSGF(QCPFMSG) +
                               
    MSGDTA(&SAVFMSGTYPE(*ESCAPE))
                  ELSE       
    CMD(IF COND(&ERRDTA *NE ' 'THEN(SNDPGMMSG +
                               
    MSGID(CPF9898MSGF(QCPFMSGMSGDTA('Save +
                               file data generated with' 
    *BCAT &ERRDTA +
                               *
    BCAT 'command not supported') +
                               
    MSGTYPE(*ESCAPE)))
     
                  
    /* Branch around error handling routine */
                  
    GOTO       CMDLBL(ENDPGM)
     
                  
    /* Error handling routine */
      
    ERROR:      RCVMSG     MSGTYPE(*EXCPMSGDTA(&MSGDTAMSGID(&MSGID)
                  
    SNDPGMMSG  MSGID(&MSGIDMSGF(QCPFMSGMSGDTA(&MSGDTA) +
                               
    MSGTYPE(*ESCAPE)
      
    ENDPGM:     ENDPGM 
    PHP Code:
     .*===================================================================*
     .* 
    To compile:                                                       *
     .*                                                                   *
     .*           
    CRTPNLGRP  PNLGRP(XXX/SAV001PGSRCFILE(XXX/QPNLSRC)    *
     .*                                                                   *
     .*===================================================================*
     :
    PNLGRP.
     .*====================================================================
     .* Class 
    Definitions
     
    .*====================================================================
     :CLASS    
    NAME=optcls   BASETYPE=action.
     :
    ECLASS.
     :CLASS    
    NAME=objcls   BASETYPE='OBJNAME 10'.
     :
    ECLASS.
     :CLASS    
    NAME=typcls   BASETYPE='CHAR 7'.
     :
    ECLASS.
     :CLASS    
    NAME=txtcls   BASETYPE='CHAR 40'.
     :
    ECLASS.
     :CLASS    
    NAME=prmcls   BASETYPE='CHAR 255'.
     :
    ECLASS.
     .*====================================================================
     .* 
    Variable Definitions
     
    .*====================================================================
     :VAR      
    NAME=sfn      CLASS=objcls.
     :VAR      
    NAME=sfl      CLASS=objcls.
     :VAR      
    NAME=cmd      CLASS=objcls.
     :VAR      
    NAME=ofl      CLASS=objcls.
     :VAR      
    NAME=lib      CLASS=objcls.
     :VAR      
    NAME=tfl      CLASS=objcls.
     :VAR      
    NAME=opt      CLASS=optcls.
     :VAR      
    NAME=obj      CLASS=objcls.
     :VAR      
    NAME=typ      CLASS=typcls.
     :VAR      
    NAME=atr      CLASS=objcls.
     :VAR      
    NAME=txt      CLASS=txtcls.
     :VAR      
    NAME=prm      CLASS=prmcls.
     .*====================================================================
     .* 
    Variable Record and List Definitions
     
    .*====================================================================
     :
    VARRCD  NAME=header    VARS='sfn sfl cmd ofl lib tfl'
              
    NOGET='sfn sfl cmd ofl lib tfl'.
     :
    VARRCD  NAME=detail    VARS='opt obj typ atr txt'
              
    NOGET='obj typ atr txt'.
     :
    LISTDEF NAME=detlst    VARS='opt obj typ atr txt'
              
    MSGID=EDT0417  MSGF='QPDA/QEDTMSG'.
     .*====================================================================
     .* 
    Key Definitions
     
    .*====================================================================
     :
    KEYL  NAME=fkeys.
     :
    KEYI  KEY=enter    HELP=hlp  ACTION=enter.
     :
    KEYI  KEY=help     HELP=hlp  ACTION=help.
     :
    KEYI  KEY=f1       HELP=hlp  ACTION=help.
     :
    KEYI  KEY=f3       HELP=hlp  ACTION=exit     VARUPD=no  .F3=Exit
     :
    KEYI  KEY=f4       HELP=hlp  ACTION=prompt              .F4=Prompt
     
    :KEYI  KEY=f9       HELP=hlp  ACTION=retrieve            .F9=Retrieve
     
    :KEYI  KEY=f12      HELP=hlp  ACTION=cancel   VARUPD=no  .F12=Cancel
     
    :KEYI  KEY=pagedown HELP=hlp  ACTION=pagedown.
     :
    KEYI  KEY=pageup   HELP=hlp  ACTION=pageup.
     :
    KEYI  KEY=print    HELP=hlp  ACTION=print.
     :
    EKEYL.
     .*====================================================================
     .* 
    Panel Definition
     
    .*====================================================================
     :
    PANEL NAME=SAV001PG KEYL=fkeys HELP=hlp
            TOPSEP
    =space .Work with Save File Objects
     
    :DATA     DEPTH=4         LAYOUT=2    compact.
     :
    DATACOL  WIDTH=19.
     
    :DATACOL  WIDTH='*'.
     :
    DATAGRP  GRPSEP=qindent  compact.
     :
    DATAI    VAR=sfn         HELP=hlp    USAGE=out  .Save file
     
    :DATAI    VAR=sfl         HELP=hlp    USAGE=out  .Library
     
    :EDATAGRP.
     :
    DATAI    VAR=cmd         HELP=hlp    USAGE=out  .Save command
     
    :DATAGRP  GRPSEP=qindent  compact.
     :
    DATAI    VAR=ofl         HELP=hlp    USAGE=out  .Object
     
    :DATAI    VAR=lib         HELP=hlp    USAGE=out  .Library
     
    :EDATAGRP.
     :
    DATAI    VAR=tfl         HELP=hlp    USAGE=out  .Object type
     
    :EDATA.
     :LIST     
    DEPTH=14  LISTDEF=detlst  MAXHEAD=1  ACTOR=uim  PARMS=prm.
     :
    TOPINST .Type optionspress Enter.
     :
    LISTACT  ENTER='CMD RSTOBJ OBJ(&obj.) SAVLIB(&lib.) DEV(*SAVF)'
               
    ENTER='OBJTYPE(&typ.) SAVF(&sfl./&sfn.) &prm.'
               
    PROMPT='CMD ?RSTOBJ ?*OBJ(&obj.) ?*SAVLIB(&lib.)'
               
    PROMPT='?*DEV(*SAVF) ?*OBJTYPE(&typ.) ?*SAVF(&sfl./&sfn.)'
               
    PROMPT='&prm.' HELP=hlp OPTION=1  .1=Restore object
     
    :LISTCOL  VAR=opt   USAGE=inout   MAXWIDTH=3   HELP=hlp  .Opt
     
    :LISTCOL  VAR=obj   USAGE=out     MAXWIDTH=10  HELP=hlp  .Object
     
    :LISTCOL  VAR=typ   USAGE=out     MAXWIDTH=7   HELP=hlp  .Type
     
    :LISTCOL  VAR=atr   USAGE=out     MAXWIDTH=10  HELP=hlp  .Attribute
     
    :LISTCOL  VAR=txt   USAGE=out     MAXWIDTH=40  HELP=hlp  .Text
     
    :LISTVIEW COLS='opt obj typ atr txt'.
     :
    ELIST.
     :
    CMDLINE  SIZE=short  .Parameters or command
     
    :EPANEL.
     .*====================================================================
     .* 
    Help Module
     
    .*====================================================================
     :
    HELP     NAME=hlp.
     :
    EHELP.
     :
    EPNLGRP
    PHP Code:
      *===============================================================
      * 
    To compile:
      *
      *      
    CRTRPGPGM  PGM(XXX/SAV001RGSRCFILE(XXX/QRPGSRC)
      *
      *===============================================================
      *. 
    ...+... ...+... ...+... ...+... ...+... ...+... 7
     IGENDS       DS
     I                                    B 125 1280OFFLST
     I                                    B 133 1360NUMLST
     I                                    B 137 1400SIZENT
     ILIBINF      DS                             72
     I                                        1  10 SAVLIB
     I                                       11  20 SAVCMD
     I                                       11  16 SAVCM6
     IOBJINF      DS                            204
     I                                        1  10 OBJNAM
     I                                       21  30 OBJTYP
     I                                       31  40 OBJATR
     I                                      155 194 OBJTXT
     ILIBBUF      DS
     I                                        1  10 SFN
     I                                       11  20 SFL
     I                                       21  30 CMD
     I                                       31  40 OFL
     I                                       41  50 LIB
     I                                       51  60 TFL
     IOBJBUF      DS
     I                                    B   1   20OPT
     I                                        3  12 OBJ
     I                                       13  19 TYP
     I                                       20  29 ATR
     I                                       30  69 TXT
     I           IDS
     I I            
    'SAV001US  QTEMP     '    1  20 USRSPC
     I I            
    'SAV001PG  *LIBL     '   21  40 PNLGRP
     I                                    B  41  440STRPOS
     I                                    B  45  480STRLEN
     I                                    B  49  520LENSPC
     I                                    B  53  560STKCNT
     I                                    B  57  600APPSCP
     I                                    B  61  640EXTPRM
     I                                    B  65  680ERRCOD
     I                                    B  69  720FKEY
     I                                    B  73  760VARLEN
      
    *===============================================================
     
    C           *ENTRY    PLIST
     C                     PARM           SAVF   20
     C                     PARM           OBJFLT 10
     C                     PARM           TYPFLT 10
     C                     PARM           ERRDTA 10
      
    *
      * 
    Load user space with library level information
     C                     MOVEL
    'SAVF0100'FMTNAM  8
     C                     EXSR LODSPC
      
    *
      * 
    Get library level information from user space
     C                     CALL 
    'QUSRTVUS'
     
    C                     PARM           USRSPC
     C                     PARM           STRPOS
     C                     PARM           STRLEN
     C                     PARM           LIBINF
      
    *
      * 
    Perform error checking selection
     C                     SELEC
      
    *
      * If 
    no data issue message
     C           SAVLIB    WHEQ 
    *BLANKS
     C                     MOVEL
    '*EMPTY'  ERRDTA
      
    *
      * If 
    unsupported save command issue message
     C           SAVCM6    WHNE 
    'SAVLIB'
     
    C           SAVCM6    ANDNE'SAVOBJ'
     
    C           SAVCM6    ANDNE'SAVCHG'
     
    C                     MOVELSAVCMD    ERRDTA
      
    *
      * 
    Otherwise process data
     C                     OTHER
     C                     EXSR PROCES
     C                     ENDSL
      
    *
     
    C                     MOVE *ON       *INLR
      
    *===============================================================
     
    C           LODSPC    BEGSR
      
    *
      * 
    Call the list save file API
     C                     CALL 
    'QSRLSAVF'
     
    C                     PARM           USRSPC
     C                     PARM           FMTNAM
     C                     PARM           SAVF
     C                     PARM           OBJFLT
     C                     PARM           TYPFLT
     C                     PARM 
    *BLANKS   CNTHND 36
     C                     PARM 0         ERRCOD
      
    *
      * 
    Retrieve the generic header
     C                     Z
    -ADD1         STRPOS
     C                     Z
    -ADD140       STRLEN
      
    *
     
    C                     CALL 'QUSRTVUS'
     
    C                     PARM           USRSPC
     C                     PARM           STRPOS
     C                     PARM           STRLEN
     C                     PARM           GENDS
      
    *
      * 
    Calculate starting position and length
     C           OFFLST    ADD  1         STRPOS
     C                     Z
    -ADDSIZENT    STRLEN
      
    *
     
    C                     ENDSR
      
    *===============================================================
     
    C           PROCES    BEGSR
      
    *
      * 
    Open display application
     C                     CALL 
    'QUIOPNDA'
     
    C                     PARM           HANDLE  8
     C                     PARM           PNLGRP
     C                     PARM 
    -1        APPSCP
     C                     PARM           EXTPRM
     C                     PARM 
    'N'       FULHLP  1
     C                     PARM 0         ERRCOD
      
    *
      * 
    Put the library level information on the screen
     C                     MOVELSAVF      SFN
     C                     MOVE SAVF      SFL
     C                     MOVELSAVCMD    CMD
     C                     MOVELOBJFLT    OFL
     C                     MOVELSAVLIB    LIB
     C                     MOVELTYPFLT    TFL
      
    *
     
    C                     CALL 'QUIPUTV'
     
    C                     PARM           HANDLE
     C                     PARM           LIBBUF
     C                     PARM 60        VARLEN
     C                     PARM 
    'HEADER'  RCDNAM 10
     C                     PARM 0         ERRCOD
      
    *
      * 
    Load user space with object level information
     C                     MOVEL
    'SAVF0200'FMTNAM
     C                     EXSR LODSPC
     C                     MOVEL
    'FRST'    OPTION  4
      
    *
      * 
    Get object level information from user space
     C                     
    DO   NUMLST
     C                     CALL 
    'QUSRTVUS'
     
    C                     PARM           USRSPC
     C                     PARM           STRPOS
     C                     PARM           STRLEN
     C                     PARM           OBJINF
      
    *
      * 
    Exclude library objects from list
     
    C           OBJTYP    IFNE '*LIB'
     
    C                     Z-ADD0         OPT
     C                     MOVELOBJNAM    OBJ
     C                     MOVELOBJTYP    TYP
     C                     MOVELOBJATR    ATR
     C                     MOVELOBJTXT    TXT
      
    *
      * 
    Add a list entry to the screen
     C                     CALL 
    'QUIADDLE'
     
    C                     PARM           HANDLE
     C                     PARM           OBJBUF
     C                     PARM 69        VARLEN
     C                     PARM 
    'DETAIL'  RCDNAM 10
     C                     PARM 
    'DETLST'  LSTNAM 10
     C                     PARM           OPTION
     C                     PARM           LEHNDL  4
     C                     PARM 0         ERRCOD
      
    *
     
    C                     MOVEL'NEXT'    OPTION
     C                     
    ENDIF
      *
      * 
    Calculate position of next entry
     C                     ADD  SIZENT    STRPOS
     C                     ENDDO
      
    *
      * 
    Display the panel
     C                     CALL 
    'QUIDSPP'
     
    C                     PARM           HANDLE
     C                     PARM           FKEY
     C                     PARM 
    'SAV001PG'PNLNAM 10
     C                     PARM 
    'N'       REDSPO  1
     C                     PARM 0         ERRCOD
      
    *
      * 
    Close the application
     C                     CALL 
    'QUICLOA'
     
    C                     PARM           HANDLE  8
     C                     PARM 
    'M'       CLSOPT  1
     C                     PARM 0         ERRCOD
      
    *
     
    C                     ENDSR 
    when you re-write in /free please repost.

    jamie
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: How to retrieve save-file saved date and time

      Thanks for your code here however could you please tell me what is wrong with my code that I have attached here also please see the attached snap shot of UsrSpcDta DS for error...It fills with all '*' insted of the information.

      Please help me in this.....
      Thanks in advance.


      Originally posted by jamief View Post
      try this with format 3



      an example from my second favorite site http://www.think400.dk



      PHP Code:
       /*===============================================================*/
       /* To compile:                                                   */
       /*                                                               */
       /*           CRTCMD     CMD(XXX/WRKSAVFOBJ) PGM(XXX/SAV001CL) +  */
       /*                        SRCFILE(XXX/QCMDSRC)                   */
       /*                                                               */
       /*===============================================================*/
                    
      CMD        PROMPT('Work with Save File Objects')
       
                    
      PARM       KWD(SAVFTYPE(QUALMIN(1PROMPT('Save file')
       
                    
      PARM       KWD(OBJTYPE(*GENERICDFT(*ALL) +
                                 
      SPCVAL((*ALL)) PROMPT('Object')
       
                    
      PARM       KWD(OBJTYPTYPE(*CHARLEN(10RSTD(*YES) +
                                 
      DFT(*ALLVALUES(*ALRTBL *BNDDIR *CFGL +
                                 *
      CHTFMT *CLD *CLS *CMD *CRQD *CSI *CSPMAP +
                                 *
      CSPTBL *DTAARA *DTAQ *EDTD *EXITRG *FCT +
                                 *
      FILE *FNTRSC *FORMDF *FTR *GSS *JOBD +
                                 *
      JOBQ *JOBSCD *JRN *JRNRCV *MENU *MODULE +
                                 *
      MSGF *MSGQ *NODL *OUTQ *OVL *PAGDFN +
                                 *
      PAGSEG *PDG *PGM *PNLGRP *PRDAVL *PRDDFN +
                                 *
      PRDLOD *QMFORM *QMQRY *QRYDFN *RCT *SBSD +
                                 *
      SCHIDX *SPADCT *SQLPKG *SRVPGM *SSND +
                                 *
      SVRSTG *S36 *TBL *USRIDX *USRQ *USRSPC +
                                 *
      WSCSTSPCVAL((*ALL)) PROMPT('Object type')
       
        
      QUAL:       QUAL       TYPE(*NAMELEN(10)
                    
      QUAL       TYPE(*NAMELEN(10DFT(*LIBL) +
                                 
      SPCVAL((*LIBL)) PROMPT('Library'
      PHP Code:
       /*===============================================================*/
       /* To compile:                                                   */
       /*                                                               */
       /*           CRTCLPGM   PGM(XXX/SAV001CL) SRCFILE(XXX/QCLSRC)    */
       /*                                                               */
       /*===============================================================*/
                    
      PGM        PARM(&SAVF &OBJ &OBJTYP)
       
                    
      DCL        VAR(&SAVFTYPE(*CHARLEN(20)
                    
      DCL        VAR(&OBJTYPE(*CHARLEN(10)
                    
      DCL        VAR(&OBJTYPTYPE(*CHARLEN(10)
                    
      DCL        VAR(&OBJATRTYPE(*CHARLEN(10)
                    
      DCL        VAR(&RTNLIBTYPE(*CHARLEN(10)
                    
      DCL        VAR(&ERRDTATYPE(*CHARLEN(10)
                    
      DCL        VAR(&MSGIDTYPE(*CHARLEN(7)
                    
      DCL        VAR(&MSGDTATYPE(*CHARLEN(80)
       
                    
      /* Send all errors to error handling routine */
                    
      MONMSG     MSGID(CPF0000EXEC(GOTO CMDLBL(ERROR))
       
                    
      /* Don't allow this command to be called recursively */
                    
      SNDPGMMSG  MSG(' 'TOPGMQ(*SAME (SAV001RG))
                    
      MONMSG     MSGID(CPF2469EXEC(GOTO CMDLBL(CONTINUE))
                    
      RMVMSG     PGMQ(*SAME (SAV001RG)) CLEAR(*ALL)
                    
      SNDPGMMSG  MSGID(CPF9898MSGF(QCPFMSGMSGDTA('Command +
                                 WRKSAVFOBJ already in use within this +
                                 job'
      MSGTYPE(*ESCAPE)
       
                    
      /* Check to be sure file exists */
        
      CONTINUE:   CHKOBJ     OBJ(%SST(&SAVF 11 10)/%SST(&SAVF 1 10)) +
                                 
      OBJTYPE(*FILE)
       
                    
      /* Check to be sure file is a save file */
                    
      RTVOBJD    OBJ(%SST(&SAVF 11 10)/%SST(&SAVF 1 10)) +
                                 
      OBJTYPE(*FILERTNLIB(&RTNLIB) +
                                 
      OBJATR(&OBJATR)
                    IF         
      COND(&OBJATR *NE 'SAVF'THEN(SNDPGMMSG +
                                 
      MSGID(CPF3782MSGF(QCPFMSG) +
                                 
      MSGDTA(&SAVFMSGTYPE(*ESCAPE))
                    
      CHGVAR     VAR(%SST(&SAVF 11 10)) VALUE(&RTNLIB)
       
                    
      /* Re-create the user space */
                    
      DLTUSRSPC  USRSPC(QTEMP/SAV001US)
                    
      MONMSG     MSGID(CPF0000)
                    
      CALL       PGM(QUSCRTUSPARM('SAV001US  QTEMP' '' +
                                 
      100000 '' '*ALL' '')
       
                    
      /* Call program to display save file information */
                    
      CALL       PGM(SAV001RGPARM(&SAVF &OBJ &OBJTYP &ERRDTA)
                    IF         
      COND(&ERRDTA *EQ '*EMPTY'THEN(SNDPGMMSG +
                                 
      MSGID(CPF3707MSGF(QCPFMSG) +
                                 
      MSGDTA(&SAVFMSGTYPE(*ESCAPE))
                    ELSE       
      CMD(IF COND(&ERRDTA *NE ' 'THEN(SNDPGMMSG +
                                 
      MSGID(CPF9898MSGF(QCPFMSGMSGDTA('Save +
                                 file data generated with' 
      *BCAT &ERRDTA +
                                 *
      BCAT 'command not supported') +
                                 
      MSGTYPE(*ESCAPE)))
       
                    
      /* Branch around error handling routine */
                    
      GOTO       CMDLBL(ENDPGM)
       
                    
      /* Error handling routine */
        
      ERROR:      RCVMSG     MSGTYPE(*EXCPMSGDTA(&MSGDTAMSGID(&MSGID)
                    
      SNDPGMMSG  MSGID(&MSGIDMSGF(QCPFMSGMSGDTA(&MSGDTA) +
                                 
      MSGTYPE(*ESCAPE)
        
      ENDPGM:     ENDPGM 
      PHP Code:
       .*===================================================================*
       .* 
      To compile:                                                       *
       .*                                                                   *
       .*           
      CRTPNLGRP  PNLGRP(XXX/SAV001PGSRCFILE(XXX/QPNLSRC)    *
       .*                                                                   *
       .*===================================================================*
       :
      PNLGRP.
       .*====================================================================
       .* Class 
      Definitions
       
      .*====================================================================
       :CLASS    
      NAME=optcls   BASETYPE=action.
       :
      ECLASS.
       :CLASS    
      NAME=objcls   BASETYPE='OBJNAME 10'.
       :
      ECLASS.
       :CLASS    
      NAME=typcls   BASETYPE='CHAR 7'.
       :
      ECLASS.
       :CLASS    
      NAME=txtcls   BASETYPE='CHAR 40'.
       :
      ECLASS.
       :CLASS    
      NAME=prmcls   BASETYPE='CHAR 255'.
       :
      ECLASS.
       .*====================================================================
       .* 
      Variable Definitions
       
      .*====================================================================
       :VAR      
      NAME=sfn      CLASS=objcls.
       :VAR      
      NAME=sfl      CLASS=objcls.
       :VAR      
      NAME=cmd      CLASS=objcls.
       :VAR      
      NAME=ofl      CLASS=objcls.
       :VAR      
      NAME=lib      CLASS=objcls.
       :VAR      
      NAME=tfl      CLASS=objcls.
       :VAR      
      NAME=opt      CLASS=optcls.
       :VAR      
      NAME=obj      CLASS=objcls.
       :VAR      
      NAME=typ      CLASS=typcls.
       :VAR      
      NAME=atr      CLASS=objcls.
       :VAR      
      NAME=txt      CLASS=txtcls.
       :VAR      
      NAME=prm      CLASS=prmcls.
       .*====================================================================
       .* 
      Variable Record and List Definitions
       
      .*====================================================================
       :
      VARRCD  NAME=header    VARS='sfn sfl cmd ofl lib tfl'
                
      NOGET='sfn sfl cmd ofl lib tfl'.
       :
      VARRCD  NAME=detail    VARS='opt obj typ atr txt'
                
      NOGET='obj typ atr txt'.
       :
      LISTDEF NAME=detlst    VARS='opt obj typ atr txt'
                
      MSGID=EDT0417  MSGF='QPDA/QEDTMSG'.
       .*====================================================================
       .* 
      Key Definitions
       
      .*====================================================================
       :
      KEYL  NAME=fkeys.
       :
      KEYI  KEY=enter    HELP=hlp  ACTION=enter.
       :
      KEYI  KEY=help     HELP=hlp  ACTION=help.
       :
      KEYI  KEY=f1       HELP=hlp  ACTION=help.
       :
      KEYI  KEY=f3       HELP=hlp  ACTION=exit     VARUPD=no  .F3=Exit
       :
      KEYI  KEY=f4       HELP=hlp  ACTION=prompt              .F4=Prompt
       
      :KEYI  KEY=f9       HELP=hlp  ACTION=retrieve            .F9=Retrieve
       
      :KEYI  KEY=f12      HELP=hlp  ACTION=cancel   VARUPD=no  .F12=Cancel
       
      :KEYI  KEY=pagedown HELP=hlp  ACTION=pagedown.
       :
      KEYI  KEY=pageup   HELP=hlp  ACTION=pageup.
       :
      KEYI  KEY=print    HELP=hlp  ACTION=print.
       :
      EKEYL.
       .*====================================================================
       .* 
      Panel Definition
       
      .*====================================================================
       :
      PANEL NAME=SAV001PG KEYL=fkeys HELP=hlp
              TOPSEP
      =space .Work with Save File Objects
       
      :DATA     DEPTH=4         LAYOUT=2    compact.
       :
      DATACOL  WIDTH=19.
       
      :DATACOL  WIDTH='*'.
       :
      DATAGRP  GRPSEP=qindent  compact.
       :
      DATAI    VAR=sfn         HELP=hlp    USAGE=out  .Save file
       
      :DATAI    VAR=sfl         HELP=hlp    USAGE=out  .Library
       
      :EDATAGRP.
       :
      DATAI    VAR=cmd         HELP=hlp    USAGE=out  .Save command
       
      :DATAGRP  GRPSEP=qindent  compact.
       :
      DATAI    VAR=ofl         HELP=hlp    USAGE=out  .Object
       
      :DATAI    VAR=lib         HELP=hlp    USAGE=out  .Library
       
      :EDATAGRP.
       :
      DATAI    VAR=tfl         HELP=hlp    USAGE=out  .Object type
       
      :EDATA.
       :LIST     
      DEPTH=14  LISTDEF=detlst  MAXHEAD=1  ACTOR=uim  PARMS=prm.
       :
      TOPINST .Type optionspress Enter.
       :
      LISTACT  ENTER='CMD RSTOBJ OBJ(&obj.) SAVLIB(&lib.) DEV(*SAVF)'
                 
      ENTER='OBJTYPE(&typ.) SAVF(&sfl./&sfn.) &prm.'
                 
      PROMPT='CMD ?RSTOBJ ?*OBJ(&obj.) ?*SAVLIB(&lib.)'
                 
      PROMPT='?*DEV(*SAVF) ?*OBJTYPE(&typ.) ?*SAVF(&sfl./&sfn.)'
                 
      PROMPT='&prm.' HELP=hlp OPTION=1  .1=Restore object
       
      :LISTCOL  VAR=opt   USAGE=inout   MAXWIDTH=3   HELP=hlp  .Opt
       
      :LISTCOL  VAR=obj   USAGE=out     MAXWIDTH=10  HELP=hlp  .Object
       
      :LISTCOL  VAR=typ   USAGE=out     MAXWIDTH=7   HELP=hlp  .Type
       
      :LISTCOL  VAR=atr   USAGE=out     MAXWIDTH=10  HELP=hlp  .Attribute
       
      :LISTCOL  VAR=txt   USAGE=out     MAXWIDTH=40  HELP=hlp  .Text
       
      :LISTVIEW COLS='opt obj typ atr txt'.
       :
      ELIST.
       :
      CMDLINE  SIZE=short  .Parameters or command
       
      :EPANEL.
       .*====================================================================
       .* 
      Help Module
       
      .*====================================================================
       :
      HELP     NAME=hlp.
       :
      EHELP.
       :
      EPNLGRP
      PHP Code:
        *===============================================================
        * 
      To compile:
        *
        *      
      CRTRPGPGM  PGM(XXX/SAV001RGSRCFILE(XXX/QRPGSRC)
        *
        *===============================================================
        *. 
      ...+... ...+... ...+... ...+... ...+... ...+... 7
       IGENDS       DS
       I                                    B 125 1280OFFLST
       I                                    B 133 1360NUMLST
       I                                    B 137 1400SIZENT
       ILIBINF      DS                             72
       I                                        1  10 SAVLIB
       I                                       11  20 SAVCMD
       I                                       11  16 SAVCM6
       IOBJINF      DS                            204
       I                                        1  10 OBJNAM
       I                                       21  30 OBJTYP
       I                                       31  40 OBJATR
       I                                      155 194 OBJTXT
       ILIBBUF      DS
       I                                        1  10 SFN
       I                                       11  20 SFL
       I                                       21  30 CMD
       I                                       31  40 OFL
       I                                       41  50 LIB
       I                                       51  60 TFL
       IOBJBUF      DS
       I                                    B   1   20OPT
       I                                        3  12 OBJ
       I                                       13  19 TYP
       I                                       20  29 ATR
       I                                       30  69 TXT
       I           IDS
       I I            
      'SAV001US  QTEMP     '    1  20 USRSPC
       I I            
      'SAV001PG  *LIBL     '   21  40 PNLGRP
       I                                    B  41  440STRPOS
       I                                    B  45  480STRLEN
       I                                    B  49  520LENSPC
       I                                    B  53  560STKCNT
       I                                    B  57  600APPSCP
       I                                    B  61  640EXTPRM
       I                                    B  65  680ERRCOD
       I                                    B  69  720FKEY
       I                                    B  73  760VARLEN
        
      *===============================================================
       
      C           *ENTRY    PLIST
       C                     PARM           SAVF   20
       C                     PARM           OBJFLT 10
       C                     PARM           TYPFLT 10
       C                     PARM           ERRDTA 10
        
      *
        * 
      Load user space with library level information
       C                     MOVEL
      'SAVF0100'FMTNAM  8
       C                     EXSR LODSPC
        
      *
        * 
      Get library level information from user space
       C                     CALL 
      'QUSRTVUS'
       
      C                     PARM           USRSPC
       C                     PARM           STRPOS
       C                     PARM           STRLEN
       C                     PARM           LIBINF
        
      *
        * 
      Perform error checking selection
       C                     SELEC
        
      *
        * If 
      no data issue message
       C           SAVLIB    WHEQ 
      *BLANKS
       C                     MOVEL
      '*EMPTY'  ERRDTA
        
      *
        * If 
      unsupported save command issue message
       C           SAVCM6    WHNE 
      'SAVLIB'
       
      C           SAVCM6    ANDNE'SAVOBJ'
       
      C           SAVCM6    ANDNE'SAVCHG'
       
      C                     MOVELSAVCMD    ERRDTA
        
      *
        * 
      Otherwise process data
       C                     OTHER
       C                     EXSR PROCES
       C                     ENDSL
        
      *
       
      C                     MOVE *ON       *INLR
        
      *===============================================================
       
      C           LODSPC    BEGSR
        
      *
        * 
      Call the list save file API
       C                     CALL 
      'QSRLSAVF'
       
      C                     PARM           USRSPC
       C                     PARM           FMTNAM
       C                     PARM           SAVF
       C                     PARM           OBJFLT
       C                     PARM           TYPFLT
       C                     PARM 
      *BLANKS   CNTHND 36
       C                     PARM 0         ERRCOD
        
      *
        * 
      Retrieve the generic header
       C                     Z
      -ADD1         STRPOS
       C                     Z
      -ADD140       STRLEN
        
      *
       
      C                     CALL 'QUSRTVUS'
       
      C                     PARM           USRSPC
       C                     PARM           STRPOS
       C                     PARM           STRLEN
       C                     PARM           GENDS
        
      *
        * 
      Calculate starting position and length
       C           OFFLST    ADD  1         STRPOS
       C                     Z
      -ADDSIZENT    STRLEN
        
      *
       
      C                     ENDSR
        
      *===============================================================
       
      C           PROCES    BEGSR
        
      *
        * 
      Open display application
       C                     CALL 
      'QUIOPNDA'
       
      C                     PARM           HANDLE  8
       C                     PARM           PNLGRP
       C                     PARM 
      -1        APPSCP
       C                     PARM           EXTPRM
       C                     PARM 
      'N'       FULHLP  1
       C                     PARM 0         ERRCOD
        
      *
        * 
      Put the library level information on the screen
       C                     MOVELSAVF      SFN
       C                     MOVE SAVF      SFL
       C                     MOVELSAVCMD    CMD
       C                     MOVELOBJFLT    OFL
       C                     MOVELSAVLIB    LIB
       C                     MOVELTYPFLT    TFL
        
      *
       
      C                     CALL 'QUIPUTV'
       
      C                     PARM           HANDLE
       C                     PARM           LIBBUF
       C                     PARM 60        VARLEN
       C                     PARM 
      'HEADER'  RCDNAM 10
       C                     PARM 0         ERRCOD
        
      *
        * 
      Load user space with object level information
       C                     MOVEL
      'SAVF0200'FMTNAM
       C                     EXSR LODSPC
       C                     MOVEL
      'FRST'    OPTION  4
        
      *
        * 
      Get object level information from user space
       C                     
      DO   NUMLST
       C                     CALL 
      'QUSRTVUS'
       
      C                     PARM           USRSPC
       C                     PARM           STRPOS
       C                     PARM           STRLEN
       C                     PARM           OBJINF
        
      *
        * 
      Exclude library objects from list
       
      C           OBJTYP    IFNE '*LIB'
       
      C                     Z-ADD0         OPT
       C                     MOVELOBJNAM    OBJ
       C                     MOVELOBJTYP    TYP
       C                     MOVELOBJATR    ATR
       C                     MOVELOBJTXT    TXT
        
      *
        * 
      Add a list entry to the screen
       C                     CALL 
      'QUIADDLE'
       
      C                     PARM           HANDLE
       C                     PARM           OBJBUF
       C                     PARM 69        VARLEN
       C                     PARM 
      'DETAIL'  RCDNAM 10
       C                     PARM 
      'DETLST'  LSTNAM 10
       C                     PARM           OPTION
       C                     PARM           LEHNDL  4
       C                     PARM 0         ERRCOD
        
      *
       
      C                     MOVEL'NEXT'    OPTION
       C                     
      ENDIF
        *
        * 
      Calculate position of next entry
       C                     ADD  SIZENT    STRPOS
       C                     ENDDO
        
      *
        * 
      Display the panel
       C                     CALL 
      'QUIDSPP'
       
      C                     PARM           HANDLE
       C                     PARM           FKEY
       C                     PARM 
      'SAV001PG'PNLNAM 10
       C                     PARM 
      'N'       REDSPO  1
       C                     PARM 0         ERRCOD
        
      *
        * 
      Close the application
       C                     CALL 
      'QUICLOA'
       
      C                     PARM           HANDLE  8
       C                     PARM 
      'M'       CLSOPT  1
       C                     PARM 0         ERRCOD
        
      *
       
      C                     ENDSR 
      when you re-write in /free please repost.

      jamie
      Attached Files
      Cheers...
      Nil

      Comment


      • #4
        Re: How to retrieve save-file saved date and time

        Shooting from the hip..I would guess one or more of the API's have changed since this was written in 1911...
        I will try to give this a test today, but I think this is going to be a busy week for me...

        Jamie
        All my answers were extracted from the "Big Dummy's Guide to the As400"
        and I take no responsibility for any of them.

        www.code400.com

        Comment


        • #5
          Re: How to retrieve save-file saved date and time

          Thanks Jamie.....

          Originally posted by jamief View Post
          Shooting from the hip..I would guess one or more of the API's have changed since this was written in 1911...
          I will try to give this a test today, but I think this is going to be a busy week for me...

          Jamie
          Cheers...
          Nil

          Comment


          • #6
            Re: How to retrieve save-file saved date and time

            Consider reading
            1/ the API related page on the Infocenter : it's something worth to learn.
            2/ again the Jamie's post #2 above as format 3 is specified

            Change the format name used from SAVF0100 to SAVF0200 or SAVF0300 and define the format template in order to get the appropriate information you're looking for.
            Last edited by Mercury; January 31, 2011, 07:54 AM.
            Philippe

            Comment


            • #7
              Re: How to retrieve save-file saved date and time

              I have changed the format to either SAVF0200 or SAVF0300 but no luck and please tell me what do you mean by 'define the format template in order to get the appropriate information' from your reply. I do not understand this part.

              Thanks in Advance...

              Originally posted by Mercury View Post
              Consider reading
              1/ the API related page on the Infocenter : it's something worth to learn.
              2/ again the Jamie's post #2 above as format 3 is specified

              Change the format name used from SAVF0100 to SAVF0200 or SAVF0300 and define the format template in order to get the appropriate information you're looking for.
              Cheers...
              Nil

              Comment


              • #8
                Re: How to retrieve save-file saved date and time

                You must first understand how the List Save File (QSRLSAVF) API works.

                The program Jamie posted is written to return only the data coming from the SAVF0100 format. You want it to return the date and time of saved objects. Those reside in the SAVF0200 or SAVF0300 format. So for the program to work you need to change the format name to SAVF0200 or SAVF0300 and define a new DS that complies with the chosen format then put the returned data into the user space. You will find the format descriptions returned by the List Save File (QSRLSAVF) API on the Infocenter page here.
                However I think you would be better off using this link, the RPG III language being a little behind the times nowadays.
                Beware of date and time as the value is in system time-stamp format and can be converted to several other formats with the Convert Date and Time Format (QWCCVTDT) API and format *DTS. Look here.
                Philippe

                Comment


                • #9
                  Re: How to retrieve save-file saved date and time

                  Thanks for your valuable reply I got the values inside the DS.
                  But my problem is little bit different, I want the following information from save-file.

                  Using DSPSAVF FILE(Mylib/MySavf)
                  Then press F16=Display header

                  In the 'Display Save Header' we can see from 'Save operation:' below information
                  Save Command: SAVLIB
                  Save date/time: 02/02/11 00:31:00

                  Please see the snap shot.
                  Please tell me how I can get this information from save-file header? I do not want the objects saved I want when this save-file was saved date and time using any command like SAVLIB or SAVOBJ.



                  Originally posted by Mercury View Post
                  You must first understand how the List Save File (QSRLSAVF) API works.

                  The program Jamie posted is written to return only the data coming from the SAVF0100 format. You want it to return the date and time of saved objects. Those reside in the SAVF0200 or SAVF0300 format. So for the program to work you need to change the format name to SAVF0200 or SAVF0300 and define a new DS that complies with the chosen format then put the returned data into the user space. You will find the format descriptions returned by the List Save File (QSRLSAVF) API on the Infocenter page here.
                  However I think you would be better off using this link, the RPG III language being a little behind the times nowadays.
                  Beware of date and time as the value is in system time-stamp format and can be converted to several other formats with the Convert Date and Time Format (QWCCVTDT) API and format *DTS. Look here.
                  Attached Files
                  Cheers...
                  Nil

                  Comment


                  • #10
                    Re: How to retrieve save-file saved date and time

                    DSPOBJD OBJ(SavfLib/SavfName) OBJTYPE(*FILE) OUTPUT(*OUTFILE) OUTFILE(OutLib/OutFile)

                    You can get the following fields from the outfile from CL/RPG/SQL as you see fit ...

                    PHP Code:
                    Field           Text                                                  Len  Dec
                    ODOBOW          Object owner                                           10     
                    ODSCEN          Save century
                    0=19xx1=20xx                            1     
                    ODSDAT          Save date 
                    (MMDDYY)                                      6     
                    ODSTIM          Save time 
                    (HHMMSS)                                      6     
                    ODSCMD          Save command                                           10     
                    ODSSZE          Saved size                                             10    0
                    ODSSLT          Starting slot                                           2    0
                    ODSDEV          Save device                                            10     
                    ODSV01          Saved volume                                            6     
                    ODSV02          Saved volume                                            6     
                    ODSV03          Saved volume                                            6     
                    ODSV04          Saved volume                                            6     
                    ODSV05          Saved volume                                            6     
                    ODSV06          Saved volume                                            6     
                    ODSV07          Saved volume                                            6     
                    ODSV08          Saved volume                                            6     
                    ODSV09          Saved volume                                            6     
                    ODSV10          Saved volume                                            6     
                    ODSVMR          More volumes
                    0=No1=Yes2=Parallel save format       1 
                    Greg Craill: "Life's hard - Get a helmet !!"

                    Comment


                    • #11
                      Re: How to retrieve save-file saved date and time

                      Thanks for your reply here...however I have tried this earlier but it is not giving me the correct saved date and time. There is some time differences it shows from DSPOBJD and using DSPSAVF then F16=Display header

                      And from your post the fields like saved date and time are those are for when that save file is saved to tape.
                      I took the change date and time but it is not exactly matches with DSPSAVF saved date and time.

                      Originally posted by gcraill View Post
                      DSPOBJD OBJ(SavfLib/SavfName) OBJTYPE(*FILE) OUTPUT(*OUTFILE) OUTFILE(OutLib/OutFile)

                      You can get the following fields from the outfile from CL/RPG/SQL as you see fit ...

                      PHP Code:
                      Field           Text                                                  Len  Dec
                      ODOBOW          Object owner                                           10     
                      ODSCEN          Save century
                      0=19xx1=20xx                            1     
                      ODSDAT          Save date 
                      (MMDDYY)                                      6     
                      ODSTIM          Save time 
                      (HHMMSS)                                      6     
                      ODSCMD          Save command                                           10     
                      ODSSZE          Saved size                                             10    0
                      ODSSLT          Starting slot                                           2    0
                      ODSDEV          Save device                                            10     
                      ODSV01          Saved volume                                            6     
                      ODSV02          Saved volume                                            6     
                      ODSV03          Saved volume                                            6     
                      ODSV04          Saved volume                                            6     
                      ODSV05          Saved volume                                            6     
                      ODSV06          Saved volume                                            6     
                      ODSV07          Saved volume                                            6     
                      ODSV08          Saved volume                                            6     
                      ODSV09          Saved volume                                            6     
                      ODSV10          Saved volume                                            6     
                      ODSVMR          More volumes
                      0=No1=Yes2=Parallel save format       1 
                      Cheers...
                      Nil

                      Comment


                      • #12
                        Re: How to retrieve save-file saved date and time

                        Beats me, I don't even have an F16 to see the headers option on DSPSAVF ... is that a new feature ?
                        Greg Craill: "Life's hard - Get a helmet !!"

                        Comment


                        • #13
                          Re: How to retrieve save-file saved date and time

                          This is not new feature... you can check it using following steps:

                          1. DSPSAVF FILE(MYLIB/MYSAVF)
                          2. Press SHIFT + F4 (i.e. F16=Display header)

                          For your reference I am using OS: V6R1M0 and it was there in earlier versions as well.

                          Originally posted by gcraill View Post
                          Beats me, I don't even have an F16 to see the headers option on DSPSAVF ... is that a new feature ?
                          Cheers...
                          Nil

                          Comment


                          • #14
                            Re: How to retrieve save-file saved date and time

                            One thing I missed to mention in post #13 i.e. save-file should contain data (saved objects) then only you will see 'F16=Display header'

                            Originally posted by gcraill View Post
                            Beats me, I don't even have an F16 to see the headers option on DSPSAVF ... is that a new feature ?
                            Cheers...
                            Nil

                            Comment


                            • #15
                              Re: How to retrieve save-file saved date and time

                              That should meet your agreement this time.

                              PHP Code:
                                    ***********************************************************
                                    * 
                              Prototype for QUSCRTUS Create User Space              *
                                    ***********************************************************
                                   
                              D QUSCRTUS        PR                  ExtPgm('QUSCRTUS')
                                   
                              D   UserSpace                   20a   const
                                   
                              D   Attrib                      10a   const
                                   
                              D   InitSize                    10i 0 const
                                   
                              D   InitVal                      1A   const
                                   
                              D   PubAuth                     10a   const
                                   
                              D   Text                        50a   const
                                    * 
                              optional group 1:
                                   
                              D   Replace                     10a   const options(*nopass)
                                   
                              D   ErrorCode                         like(MyErrCode)
                                   
                              D                                     options(*varsize: *nopass)
                                    * 
                              optional group 2:
                                   
                              D   Domain                      10a   const options(*nopass)
                                    * 
                              optional group 3:
                                   
                              D   XferSizeReq                 10i 0 const options(*nopass)
                                   
                              D   OptAlign                     1A   const options(*nopass)

                                    ***********************************************************
                                    * 
                              Prototype for QSRLSAVF - List Save File                 *
                                    ***********************************************************
                                   
                              D QSRLSAVF        PR                  ExtPgm('QSRLSAVF')
                                   
                              D   UserSpace                   20a   const
                                   
                              D   Format                       8a   const
                                   
                              D   SaveFile                    20a   const
                                   
                              D   NameFilter                  10a   const
                                   
                              D   TypeFilter                  10a   const
                                   
                              D   ContHandle                  36a   const
                                   
                              D   ErrorCode                         like(MyErrCode)
                                   
                              D                                     options(*varsize: *nopass)

                                    ***********************************************************
                                    * 
                              Prototype for QUSPTRUS Retrieve Pointer to User Space *
                                    ***********************************************************
                                   
                              D QUSPTRUS        PR                  ExtPgm('QUSPTRUS')
                                   
                              D   UserSpace                   20a   const
                                   
                              D   Format                        *
                                   
                              D   ErrorCode                         like(MyErrCode)
                                   
                              D                                     options(*varsize: *nopass)

                                    ***********************************************************
                                    * 
                              Prototype for QUSRTVUS Retrieve User Space            *
                                    ***********************************************************
                                   
                              D QUSRTVUS        PR                  ExtPgm('QUSRTVUS')
                                   
                              D   UserSpace                   20a   const
                                   
                              D   StartPos                    10i 0 const
                                   
                              D   Length                      10i 0 const
                                   
                              D   UsrSpcData                 203a   const
                                   
                              D   ErrorCode                         like(MyErrCode)
                                   
                              D                                     options(*varsize: *nopass)

                                    ***********************************************************
                                    * 
                              Prototype for QWCCVTDT Convert Date and Time Format   *
                                    ***********************************************************
                                   
                              D QWCCVTDT        PR                  ExtPgm'QWCCVTDT' )
                                   
                              D  CvtInputFmt                  10
                                   D  CvtInputDate                 17
                                   D  CvtOutputFmt                 10
                                   D  CvtOutputDate                17
                                   D   ErrorCode                         like
                              (MyErrCode)
                                   
                              D                                     options(*varsize: *nopass)

                                   
                              D  InputFmt       S             10
                                   D  InputDate      S             17
                                   D  OutputFmt      S             10
                                   D  OutputDate     S             17

                                    
                              ***********************************************************
                                    * 
                              API error code data structure                           *
                                    ***********************************************************
                                   
                              D MyErrCode       DS
                                   D  BytesProv                    10i 0 inz
                              (%size(MyErrCode))
                                   
                              D  BytesAvail                   10i 0 inz(0)
                                   
                              D  MsgID                         7a
                                   D  Reserved                      1a
                                   D  MessageData                 512a

                                    
                              ***********************************************************
                                    * 
                              Header Definition                                       *
                                    ***********************************************************
                                   
                              dListHdr          DS                  based(HdrPtr)
                                   
                              d                              124a
                                   d OffLstEnt                     10i 0
                                   d SizDtaSec                     10i 0
                                   d NbrLstEnt                     10i 0
                                   d SizLstEnt                     10i 0

                                   d UsrSpc          S             20a   inz
                              ('USRSPC    QTEMP     ')
                                   
                              d ErrCod          S             10i 0 inz(0)

                                   
                              d Savf            DS              
                                   d  SavfName                     10a   inz
                              ('MySAVF'
                                   
                              d  SavfLib                      10a   inz('MyLib'

                                   
                              d SAVF0100        DS                  based(ListPtr)
                                   
                              d                                     qualified
                                   d  LibName                      10a
                                   d  SavCmd                       10a
                                   d  SavDT                         8a
                                   d  SavASP                       10i 0
                                   d  Rcds                         10i 0
                                   d  SavObj                       10i 0
                                   d  SavAcp                       10i 0
                                   d  SavAct                       10a
                                   d  RlsLvl                        6a
                                   d  DtaCpd                        1a
                                   d  SysSRLn                       8a
                                   d  PrvAut                        1a
                                   d                                2a
                                   d  ASPDevNm                     10a
                                   d                                2a
                                   d  MbrLibSav                    10i 0
                                   d  SplFilSav                    10i 0
                                   d  SyncID                       10a

                                   d SAVF0200        DS                  based
                              (ListPtr)
                                   
                              d                                     qualified
                                   d  ObjName                      10a
                                   d  LibName                      10a
                                   d  ObjType                      10a
                                   d  ObjAttr                      10a
                                   d  SavDate                       8a
                                   d  ObjSize                      10i 0
                                   d  ObjSzMl                      10i 0
                                   d  StgPool                      10i 0
                                   d  DatSave                       1a
                                   d  ObjOwnr                      10a
                                   d  DloName                      20a
                                   d  FdrName                      63a
                                   d  Descrip                      50a
                                   d  DevName                      10a

                                    
                              ***********************************************************
                                    * 
                              Work Fields                                             *
                                    ***********************************************************
                                   
                              d FmtName         S              8a   inz('SAVF0100')
                                   
                              d UsSize          S             10i 0
                                   d Handle          S             36a
                                   d EntryNo         S             10i 0

                                    
                              ***********************************************************
                                    * 
                              Create User Space for API Usage                         *
                                    ***********************************************************
                                   
                              c                   if        FmtName 'SAVF0100'
                                   
                              c                   eval      UsSize = %size(SAVF0100) * 1024
                                   c                   
                              else
                                   
                              c                   eval      UsSize = %size(SAVF0200) * 1024
                                   c                   
                              endif

                                   
                              c                   callp     QUSCRTUSUsrSpc
                                   c                                     
                              ' '
                                   
                              c                                     : %size(UsSize)
                                   
                              c                                     x'00'
                                   
                              c                                     '*USE'
                                   
                              c                                     'Save File Information'
                                   
                              c                                     '*YES'
                                   
                              c                                     MyErrCode)

                                    ***********************************************************
                                    * List 
                              Save File Details                                  *
                                    ***********************************************************
                                   
                              c                   callp     QSRLSAVFUsrSpc
                                   c                                     
                              FmtName
                                   c                                     
                              Savf
                                   c                                     
                              '*ALL'
                                   
                              c                                     '*ALL'
                                   
                              c                                     Handle
                                   c                                     
                              MyErrCode )

                                    ***********************************************************
                                    * 
                              Retrieve Pointer to User Space                          *
                                    ***********************************************************
                                   
                              c                   callp     QUSPTRUSUsrSpc
                                   c                                     
                              HdrPtr
                                   c                                     
                              MyErrCode)

                                   
                              c                   for       EntryNo 0 to (NbrLstEnt 1)
                                   
                              c                   eval      ListPtr HdrPtr OffLstEnt +
                                   
                              c                                (SizLstEnt EntryNo)
                                    **** DO 
                              STUFF HERE

                                   c                   
                              if        FmtName 'SAVF0100'
                                    
                              All the SAVF0100 stuff is in the qualified SAVF0100 DS
                                   c                   
                              Eval      InputFmt   =  '*DTS'
                                   
                              c                   Eval      InputDate  =  SAVF0100.SavDT
                                   c                   
                              Eval      OutputFmt  =  '*YYMD'

                                   
                              c                   Callp     QWCCVTDT (InputFmt  :
                                   
                              c                                       InputDate :
                                   
                              c                                       OutputFmt :
                                   
                              c                                       OutputDate:
                                   
                              c                                       MyErrCode )

                                   
                              c                   dsply                   OutPutDate
                                   c                   
                              else
                                    * 
                              All the SAVF0200 stuff is in the qualified SAVF0200 DS
                                    
                              *                  ... 
                                   
                              c                   endif

                                   
                              c                   endfor

                                   
                              c                   seton                                        lr
                                   c                   
                              return 

                              <F16> doesn't work for me either (V5R3).
                              Philippe

                              Comment

                              Working...
                              X