× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Jimmy,

The QSHELL 'jar' command comes free with recent iSeries releases and is
mostly compatible with standard .zip software. Two things to watch:

1) Be aware of your QSH 'current directory' before issuing 'jar'. My
experience is that 'jar' includes the file's relative path in the .zip file.
Depending on the software settings of the unzip program used by your
recipients, the resulting files may be several layers deep in a directory
structure that reflects where the files were when they left your system.

2) 'jar' sets a bit in the archive file called the 'extended attribute' (or
something like that). We once had a recipient who unzipped the files with
some brand-X .dll that objected to that setting. Once they upgraded their
.dll the problem went away but it caused everyone a lot of lost time before
we could isolate the problem.

The following CL has served up well

/* Include these for CL error handling */ 
  DCL VAR(&MSGID) TYPE(*CHAR) LEN(7) 
  DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(256) 
  DCL VAR(&RESULT) TYPE(*CHAR) LEN(4) 
  DCL VAR(&STATUS) TYPE(*DEC) LEN(10 0) 
  DCL VAR(&SIGNAL) TYPE(*DEC) LEN(10 0) 
  DCL VAR(&CHARSTAT) TYPE(*CHAR) LEN(10) 
  DCL VAR(&CHARSIG) TYPE(*CHAR) LEN(10) 

  DCL VAR(&w_CmdStr) TYPE(*CHAR) LEN(3000) 
  DCL VAR(&Target) TYPE(*CHAR) LEN(60) 
  DCL  &Source       *CHAR 1525    /* totally arbitrary */ 
  DCL  &SourceDir    *CHAR   60    /* Standard path length */ 

/* Configure environment variables to allow CL to MonMsg for QSH errors */
  RMVENVVAR  ENVVAR(QIBM_QSH_CMD_OUTPUT) 
  MONMSG MSGID(CPFA981) /* ENVVAR DOES NOT EXIST */ 
  RMVENVVAR  ENVVAR(QIBM_QSH_CMD_ESCAPE_MSG) 
  MONMSG MSGID(CPFA981) /* ENVVAR DOES NOT EXIST */ 
  ADDENVVAR  ENVVAR(QIBM_QSH_CMD_OUTPUT) VALUE(NONE) 
  ADDENVVAR  ENVVAR(QIBM_QSH_CMD_ESCAPE_MSG) VALUE(Y) 

/* Build CMDSTR for 'jar' command */ 
/* 1) switch to specified directory */
/* 2) execute 'jar' command */

/* Ex: QSH CMD('cd /tmp ; jar -cfM /home/target.zip /home/src1.txt
/home/src2.txt') */ 
  ChgVar     VAR(&w_CmdStr) + 
             VALUE('cd ' *cat &SourceDir *tcat + 
                    ' ;'  *cat + 
                    ' jar -cfM ' *cat + 
                    &Target *tcat + 
                    ' ' *cat + 
                    &Source + 
                   ) 

  QSH CMD(&w_CmdStr) 

  MONMSG MSGID(QSH0005 QSH0006 QSH0007) + 
  Exec(Do) 
    RCVMSG  MSGTYPE(*LAST) RMV(*YES) MSGDTA(&MSGDTA) MsgId(&MsgId) 
   /* QSH0005 - QSH ended "NORMALLY', but not necessarily without error */ 
                 IF (&MSGID *EQ 'QSH0005') DO 
                     ChgVar VAR(&RESULT) VALUE(%SST(&MSGDTA 1 4)) 
                     ChgVar VAR(&STATUS) VALUE(%BIN(&RESULT)) 
                     ChgVar VAR(&SIGNAL) VALUE(0) 
                 EndDo 
           /* QSH0006 - QSH ended when it received a signal */ 
                 IF (&MSGID *EQ 'QSH0006') DO 
                      ChgVar VAR(&RESULT) VALUE(%SST(&MSGDTA 1 4)) 
                      ChgVar VAR(&SIGNAL) VALUE(%BIN(&RESULT)) 
                      ChgVar VAR(&STATUS) VALUE(-1) 
                  ENDDO 
           /* QSH0007 - QSH ENDED DUE TO AN EXCEPTION, Ex: program crash */ 
                  IF (&MSGID *EQ 'QSH0007') DO 
                    ChgVar VAR(&STATUS) VALUE(-1) 
                    ChgVar VAR(&SIGNAL) VALUE(-1) 
                  ENDDO

           IF (&STATUS *NE 0) THEN(DO) 
                ChgVar VAR(&CHARSTAT) VALUE(&STATUS) 
                ChgVar VAR(&CHARSIG) VALUE(&SIGNAL) 
                ChgVar &PgmRC '1' 
                ChgVar &PgmMisc ('MSGID=' *tcat &MsgId *tcat 'STATUS=' *tcat
&CharStat)  
                SNDPGMMSG  MSGID(CPF9897) MSGF(QCPFMSG) MSGDTA('QShell + 
                           command failed with status ' *CAT + 
                           &CHARSTAT *CAT ' and signal ' *CAT + 
                           &CHARSIG *CAT '. The command was:' *tCAT + 
                           &w_CmdStr *tCAT '.') 
           ENDDO 
   EndDo 



> -----midrange-l-bounces@xxxxxxxxxxxx wrote: -----
> 
> To: "Midrange-L" <midrange-L@xxxxxxxxxxxx>
> From: "Green, Jimmy" <jgreen@xxxxxxxxxxxxxxxxx>
> Sent by: midrange-l-bounces@xxxxxxxxxxxx
> Date: 06/24/2005 10:41AM
> Subject: zip file on ifs
> 
> What is the best way to zip files on the ifs? What tools are good or is
> there a native way in os/400?
> Thanks for your Help!!
> 
> Jimmy Green
> I.T. Operations Mgr
> Grocery Supply Co.
> 800-231-1938 Ext 268


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.