Easy400    |     IBM System i home    | 
Public-Source
 
About it
PKLIB walkthrough
ZIPSAVE & UNZIPSAVE commands

Download
 
 
 

Command PKLIB walk through


                Save library as a zipped *STMF (PKLIB)      
                                                                 
 Type choices, press Enter.                                      
                                                                 
 Library name . . . . . . . . . . LIB        *SELECT       Name, *SELECT  
                                                                                 
PKLIB is the command that does the packaging of a library into a zip file.

1. Packaging a library for the first time
2. Re-packaging a library
3. Template for the "Readme" file
4. Template for the "Packing List" screen
5. Unzipping a PKLIB-generated ZIP stream file


 

1. Packaging a library for the first time

To package a library named SAMPLE, you must enter command
EZPACK/PKLIB LIB(SAMPLE) .
The following screen appears:

                          Save library as a zipped *STMF

 Type data, press Enter.

 Library to be saved  . . . . . . . . . . . .   SAMPLE      name, *SELECT        
   Target release . . . . . . . . . . . . . .   V6R1M0      VxRxMx, *CURRENT, ...

 F3=End  F4=*SELECT  F12=Previous
Figure 1 - Packaging a library for the first time
The default target release for the save operation is the current release of the system, but you can change it to another supported release.

When you press the Enter key, you are requested to specify the name of an IFS directory where the zip file - containing the save file - should be created:

                          Save library as a zipped *STMF

 Type data, press Enter.

 Library to be saved  . . . . . . . . . . . .   SAMPLE      name, *SELECT        
   Target release . . . . . . . . . . . . . .   V6R1M0      VxRxMx, *CURRENT, ...

              ..................................................................
              : IFS directory where the .zip stmf should be generated          :
              :                                                                :
              : /myZipFiles                                                    :
              :                                                                :
              : F12=Cancel                                                     :
              :                                                                :
              :................................................................:
Figure 2 - IFS directory for the ZIP file
Please note that the root directory "/" is not accepted. You must specify an IFS directory within the root directory.

As soon as you press the Enter key, you are requested to specify the name of the user profile that should be used to restore this "SAMPLE" library. The name of this user profile will be mentioned in the "Readme" file bundled in the ZIP file with the save file.

                          Save library as a zipped *STMF

 Type data, press Enter.

 Library to be saved  . . . . . . . . . . . .   SAMPLE      name, *SELECT        
   Target release . . . . . . . . . . . . . .   V6R1M0      VxRxMx, *CURRENT, ...

        ................................................................     
        :                         User profile                         :     
        :                                                              :     
        : Type user profile for library restore, press Enter           :     
        :                                                              :     
        : User profile . . . . . . . . . . .  QPGMR                    :     
        : F12=Cancel                                                   :     
        :..............................................................:
Figure 3 - User profile to be used for restoring the library
The program assumes as a default the name of the current user profile, but you must replace it with the appropriate one.

when you press the Enter key, library "SAMPLE" is saved - with the requested target release - in a save file with the same name in library QGPL. This is done to make sure that the final save - which takes place at the end of this process - is successful. Should the save fail, you would by displayd an error message.
If the save has success, the text for the "Readme" file is generated and edited, so that you may update it as needed:

Date November 22, 2014                     Time  2:06 am                            
                                                                                    
                                ABOUT IT                                            
                                                                                    
This delivery contains the material needed to install                               
the IBM i library "SAMPLE"                                                          
(Title="Sample library for demonstration")                                          
on OS/400 Release V6R1M0 or subsequent.                                             
                                                                                    
This library allows you to:                                                         
.... enter your data here ...                                                       
                                                                                    
                         INSTALLATION INSTRUCTIONS                                  
                                                                                    
File "SAMPLE.savf" on your PC is the save file                                      
of library "SAMPLE".                                                                
You should transfer this file to your IBM i box,                                    
then restore library "SAMPLE" from this save file.                                  
                                                                                 
To transfer this save file to your IBM i box,                                    
you may use a FTP procedure as follow:                                           
                                                                                 
  1-On your IBM i                                                                
        CRTSAVF FILE(QGPL/SAMPLE) AUT(*ALL)                                      
  2-On your PC                                                                   
    a-open a DOS prompt                                                          
    b-position to the directory containing file "SAMPLE.savf"                    
    c-start FTP to your IBM i,                                                   
      then enter the following commands                                          
           i) binary                                                             
          ii) quote site namefmt 1                                               
         iii) cd /qsys.lib/qgpl.lib                                              
          iv) put SAMPLE.savf                                                    
           v) quit                                                               
                                                                                 
To restore library "SAMPLE":                                                     
  3-On your IBM i                                                                
           i) Signon with user profile "QPGMR"                                  
          ii) RSTLIB SAVLIB(SAMPLE) DEV(*SAVF) SAVF(QGPL/SAMPLE)                
                                                                                
That's all.                                                                     
Figure 4 - Text for the "Readme" file

As soon as you confirm the text for the "Readme" file, the program invokes command EZPACK/ZIPSAVE to

  • save again the library to a temporary save file
  • copy the save file to a stream file
  • copy the "Readme" file to another stream file
  • compress the two stream files into the requested ZIP file.
The last screen shows where the final pieces are staying:
                                   Packing List                                 

 INSTRUCTIONS FOR DELIVERING LIBRARY SAMPLE

 You have two ways to deliver your packaging of library SAMPLE:

 1-You may deliver the single IFS stream file
       /myZipFiles/sample.zip
   containing -in compressed format- the two files
       - SAMPLE.txt           and
       - SAMPLE.savf

       --- OR ---

 2-You may download to your PC and zip the two IFS stream files
       - /tmp/SAMPLE/SAMPLE.txt        and
       - /tmp/SAMPLE/SAMPLE.savf

 NOTE.
 - File SAMPLE.txt is the "ReadmeFirst" file.
 - File SAMPLE.savf is the save file of library SAMPLE.

 F3=End  F12=Previous
Figure 5 - Packing list


 

2. Re-packaging a library

When you need to release a new version of a library that you already packaged in the past with command EZPACK/PKLIB, you must enter command
EZPACK/PKLIB LIB(*SELECT) .
In this way you will be shown a list of all the libraries packaged in the past.

  • The libraries are listed by library name in ascending order.
  • If the same library was packaged several times, you will see an entry for eack package. Entries are ordered by descending date and time.
  • Each entry reports the the target release and the library title.
  • Each entry has a pointer to its "Readme" file
  • Each entry remembers the IFS path were the ZIP file was created.
               Libraries previously saved as zipped stmf's                      
                                                                                
 Position to:                                                                   
                                                                                
 Choices:  1=Select  2=Edit  4=Delete  5=Display  6=Print                       
                                                                                
               ----- SAVED -----                                                
    Library    Date       Time     TGTRLS                                       
    CENTAUR2   2012/07/31 12:56:09 V5R2M0                                       
               Centaur.com books- E-commerce example thru CGIs-V2               
    CENTAUR2   2011/02/03 11:32:56 V5R3M0                                       
               Centaur.com books- E-commerce example thru CGIs-V2               
    CGICBLDEV2 2012/04/17  5:24:35 V5R2M0                                       
               CGI development with ILE-COBOL - Version 2                       
    CGICBLDEV2 2012/02/02  4:44:10 V5R2M0                                       
               CGI development with ILE-COBOL - Version 2                       
    CGICBLDEV2 2011/07/12 14:53:37 V5R2M0                                       
               CGI development with ILE-COBOL - Version 2                       
    CGIDEV2    2013/04/22  6:12:18 V5R2M0                                       
               CGI Development Lib. V2; M. Rothman, GB. Perotti                 
                                                                        More... 
                                                                                
 F3=End  F12=Previous
Figure 6 - Libraries previously packaged

  • To reach the library you want to process, type its initial characters in "Position to" .

Options:
  • 3 prints the "Readme" memo.
  • 5 displays the "Readme" memo.
  • 4 removes the entry and the related "Readme" memo.
  • 2 lets you edit a "Readme" text. This may be done so that the next time you select that entry with option 1, you will get the updated text.
  • 1 is the most important. It performs the preliminary save, edits the existing "Readme" memo and generates the ZIPSAVE zip stream file, going through the steps illustrated in Figure 4 and Figure 5.


 

3.Template for the "Readme" file

The text of the "Readme" memos (see Figure 4) is generated from a template, member README of source file EZPACK/QTXTSRC.

You may change the template according to your needs (for instance, you could re-write it in Franch lamguage). Great care should be used with variables &n, because they are replaced with given values at execution time. The meanings of those variables are as follow:

  • &D: date
  • &T: time
  • &1: name of the saved library
  • &2: library text description
  • &4: OS/400 release the library was saved for
  • &5: name of the save file (lowercase)
  • &U: user profile to be used when restoring the library


 

4.Template for the "Packing List" screen

Also the screen in Figure 5 is generated from a template: member PACKAGE in source file EZPACK/QTXTSRC.

If you want to change it, pay attention to the following variables:

  • &1: name of the saved library
  • &3: user profile to be used when restoring the library
  • &4: IFS directory where the ZIP stream file is created
  • &5: name of the save file (lowercase)


 

5.Unzipping a PKLIB-generated ZIP stream file

You have two ways to unzip the ZIP stream file created from command PKLIB:

  1. Receive the ZIP file on your PC, and use the "Extract all" Windows facility.
    Then you will have to upload the save file to your IBM i.
  2. Receive the ZIP file on your IBM i.
    In such a case, you must have some tool on the IBM i able to unzip the ZIP file. Command EZPACK/UNZIPSAVE can do that.
 
    Contact