MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » October 2013

RE: un zip on iseries



fixed

Vern,

I've been using the code below since 2003

* Zip options
* -q quiet operation
* -u update: only changed or new files
* -r recurse into directories
* -j junk (don't record) directory names
* -m move into zipfile (delete files)

C Eval pgmnam = '/QOpenSys/usr/bin/zip'
C Eval cmd1 = '-q' + x'00'
C Eval cmd2 = '-u' + x'00'
C Eval cmd3 = '-r' + x'00'
C Eval cmd4 = '-j' + x'00'
C Eval cmd5 = '-m' + x'00'
C Eval cmd6 = ZipFile
C Eval cmd7 = %trim(DirName) + x'00'

C Call 'QP2SHELL'
C Parm pgmnam 21
C Parm cmd1 50
C Parm cmd2 50
C Parm cmd3 50
C Parm cmd4 50
C Parm cmd5 50
C Parm cmd6 50
C Parm cmd7 50

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Vernon Hamberg
Sent: Friday, 11 October 2013 8:17 a.m.
To: Midrange Systems Technical Discussion
Subject: Re: un zip on iseries

Peter

I thought you might be calling different versions - the one is in /usr/bin, the other is in /QOpenSys/usr/bin - neither is a link to the other, as some things are, that i can tell. But on our system, they seem to have the same create and change date infor and size - mmm.

QP2SHELL takes you into PASE, IIRC.

Vern (a little confused)

On 10/10/2013 1:29 PM, Peter Connell wrote:
I have versions of zip/unzip that I use via QSH for manual stuff.
For programmed solutions I just invoke the same zip or unzip via a call to QP2SHELL, pretty straight forward.

Peter

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Vernon Hamberg
Sent: Friday, 11 October 2013 6:55 a.m.
To: Midrange Systems Technical Discussion
Subject: Re: un zip on iseries

Gary

I'll jump in here.

You can specify a QShell function on the QSH CL command. An example might be if you want to put a directory listing into an IFS file.

To just show a directory listing, do this -

qsh cmd('ls')

To put a directory listing into a file named dirlist.txt in your home directory, do this.

qsh cmd('ls > dirlist.txt')

This will actually create 'dirlist.txt'.

Then run the WRKLNK command and you should see the output file.

You can even have output go to a PF, but it's a little more interesting.
That PF has to exist already. You can create it in the QShell command string, or do it with CL.

QShell commands can be chained - so this would create the PF, then run the ls command into it. The semi-colon let it ignore an error like the PF already exists. I don't remember what separator makes it stop on an error.

qsh cmd('system "crtpf qgpl/lsout rcdlen(255)"; ls >
/qsys.lib/qgpl.lib/lsout.file/lsout.mbr')

To append to that file, use a double right-arrow.

HTH
Vern

On 10/10/2013 12:38 PM, Gary Thompson wrote:
John,
I have some experience with API's, and will be working on Carsten
Flensburg's example on iPro, but you have my attention.

I do a fair amount of RPG call to QCMDEXC but never QSHELL so a
simple example would really help.

Thanks, I appreciate your posts.

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of John Yeung
Sent: Thursday, October 10, 2013 10:58 AM
To: Midrange Systems Technical Discussion
Subject: Re: un zip on iseries

On Thu, Oct 10, 2013 at 12:45 PM, Gary Thompson <gthompson@xxxxxxxxxxx> wrote:
Any reason not to use system i API zip/unzip ?
(currently looking at API example by Carsten Flensburg, published
on iPro Developer 2/8/2011)
If the rigamarole of using APIs does not put you off, and the performance of the system zip and unzip are sufficient, then no, there's no reason not to use it.

The two main reasons people typically *don't* use the system API are
(1) it's not available on their version of the operating system, and
(2) it is way easier and simpler to just use jar, ajar, or a third-party program.

Remember, anything you can do on a QSHELL or CL command line, you can
do in a CL or RPG program. (In the case of RPG, the easiest would
probably be to call QCMDEXC, which is still, for most people, way
easier than fiddling with system APIs.)

John
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.

######################################################################
###############

This correspondence is for the named person's use only. It may contain
confidential or legally privileged information, or both. No
confidentiality or privilege is waived or lost by any mistransmission.
If you receive this correspondence in error, please immediately delete
it from your system and notify the sender. You must not disclose, copy or rely on any part of this correspondence if you are not the intended recipient.
Any views expressed in this message are those of the individual
sender, except where the sender expressly, and with authority, states them to be the views of Veda.
If you need assistance, please contact Veda on either :- Australia
1300-762-207 or New Zealand +64 9 367 6200

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.

#####################################################################################

This correspondence is for the named person's use only. It may contain confidential
or legally privileged information, or both. No confidentiality or privilege is waived
or lost by any mistransmission. If you receive this correspondence in error, please
immediately delete it from your system and notify the sender. You must not disclose,
copy or rely on any part of this correspondence if you are not the intended recipient.
Any views expressed in this message are those of the individual sender, except where
the sender expressly, and with authority, states them to be the views of Veda.
If you need assistance, please contact Veda on either :-
Australia 1300-762-207 or New Zealand +64 9 367 6200





Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot 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 here. If you have questions about this, please contact