1Notes on Zip under MVS Language Environment (LE).
2
3First see README.MVS.  This note describes just one beta test on OS/390
4V2R5 using IBM's C compiler (5647A01), V2R4.  The major difference is
5the use of LE on the beta site, together with some MVS native mode
6fixes.  Changes have not been tested on CMS.
7
8Some of the notes are to clarify things that were not clear from the
9MANUAL or README.MVS.
10
111.  By default, IBM C generates the same csect name for each input
12    source.  The prelink stage does not rename them and the linkage
13    editor throws away all but the first occurrence of each duplicate.
14    Oops, my code just disappeared :(.
15
16    To get around this "feature", compile with the CSECT option to
17    force sensible names on the code and data sections of each csect.
18    The name of the static data csect defaults to the source name in
19    lower case, the code csect defaults to the source name in upper
20    case.  These csect names still have to be unique, they cannot be
21    the same as function names.  Of course, several csects have a
22    function which is the same name as the source in lower case, not
23    exactly an unusual occurrence.  Therefore to make the csect name
24    unique, some of the sources have
25
26    #ifdef MVS
27    #  pragma csect(STATIC,xxxx_s)
28    #endif
29
30    Where xxxx is an abbreviation of the source name.  There has to be
31    a better way!
32
332.  The prelink step always gets cond code 4.  It complains about
34    unresolved references, ignore it unless the linker also complains.
35    Prelink also complains about duplicate @@PPA2 sections and so does
36    the linker, but it seems to do no harm.  Compile and link steps
37    should get 0, just prelink gets 4.  See JCL at the bottom.
38
393.  Under MVS native mode (not Open Edition), tmpnam() returns a quoted
40    name of 5 qualifiers.  The first is a HLQ chosen according to the
41    MVS LE algorithm (see below), the other qualifiers are time stamps.
42    If running on MVS and tmpnam() returns a quoted name with at leat
43    one '.', it is only safe to let the user change the high level
44    qualifier.  Therefore -b insists on a single qualifier without '.'
45    in the MVS native environment.
46
474.  In Open Edition (OE) mode, the manual says that tmpnam() returns a
48    fully qualified name in directory TMPDIR or /tmp if TMPDIR is not
49    set.  There is no point in zip trying to override that name so -b
50    is ignored in MVS OE mode (untested).  The user should specify
51    environment variable TMPDIR instead.
52
535.  The MVS LE algorithm for choosing the high level qualifier for
54    native filenames is interesting, as in "May you live in interesting
55    times".  The HLQ varies according to the environment the program is
56    running in, sometimes it is userid, sometimes it is TSO prefix.
57    See OS/390 C/C++ Programming Guide, Using a Data Set Name,
58    somewhere around section 2.9.
59
60    If in doubt, use fully qualified and quoted names.  Instead of
61    archive.zip, use 'prefix.archive.zip'.  For input files, instead of
62    filename, use 'prefix.filename'.  For PARM= in JCL, double up the
63    quotes.  You even have to quote filenames in stdin.
64
656.  If your PARM includes any '/', make sure the PARM starts with '/'.
66    LE assumes anything before the first '/' is LE run time parameters.
67    It does no harm to always code a leading '/' for LE parms.
68
697.  JCL limits a PARM= to 100 characters total with approx. 65 on a
70    single line.  Alas the syntax for continuing PARM= always embeds an
71    extra ',' somewhere in the parameters that the program finally
72    gets.  No workaround, limit your PARM to a single line.  With the
73    extra quotes around filenames, that does not leave much room.  In
74    most cases, you will have to use '-@' to read the list of filenames
75    from SYSIN (stdin), it will not fit on a single PARM line.
76
778.  Filenames can be dataset names or you can refer to a ddname with
78    'DD:name', case insensitive for external files, case sensitive for
79    OE files.  You can even specify 'dd:name(mem)'.  No wildcards, to
80    zip a complete pds you have to specify each member individually.
81    Directory recursion in OE does not appear to work at the moment.
82
839.  Zip attempts to map MVS filenames to Unix style names.  It did not
84    work correctly for quoted names, fixed.  Although you can pick up
85    an external (non-OE) file with a name using any case, be aware that
86    the mapping to a Unix style name faithfully follows the case you
87    supply.
88
8910. The archive file was being created with recfm=V and lrecl=32760.
90    32760 is not valid for recfm=V under MVS, I originally changed it
91    to lrecl=32756.  Then zip broke trying to fseek() over a record
92    boundary, I do not know whether this was a zip or LE bug.  Trial
93    and error showed that recfm=U with byteseek seems to work on MVS.
94    No BDW or RDW, just a byte stream.  The blocksize is always 6144.
95
96    NOTE: This is an incompatible change from the previous beta,
97          archive files used to be recfm=V.  That should not matter
98          because we just transfer the data, ignoring BDW and RDW
99          anyway.
100
10111. Zip used to complain about preallocated but empty archives, wrong
102    length records, no signature etc.  The usual IBM/360 problem of no
103    end of file marker in a new, unopened dataset.  Fixed, see routine
104    readzipfile in zipfile.c for the gory details.  PARM= works fine.
105
10612. Several source files have records that are more than 80 bytes long.
107    It works if you transfer to mainframe datasets with a larger lrecl,
108    I used recfm=fb,lrecl=120 for the .C and .H files.  To compile with
109    anything longer than 72 bytes, you need MVS C options NOMARGINS and
110    NOSEQUENCE (NOMAR,NOSEQ).
111
11213. cmsmvs was still using zname instead of name for open.  Fixed.
113
11414. zip has to jump through a lot of hoops to see if an existing
115    zipfile actually contains data.  A side effect of this is that
116    creating a zipfile with the RLSE parameter is a waste of time.
117
118Keith Owens <kaos@ocs.com.au>.  Not a maintainer, just a beta tester.
119Mon Sep 14 19:31:30 EST 1998
120
121
122Sample JCL to compile Zip under MVS LE.  You might need a large region,
123I used REGION=128M on the job card.  Also watch the output lines,
12475,000 with OPT(2), 100,000+ with OPT(2) replaced with DEF(DEBUG).  You
125need to allocate prefix.ZIP.C.OBJ (recfm=FB, lrecl=80) and
126prefix.ZIP.LOAD (recfm=U, blksize is site defined).
127
128//CBC    JCLLIB ORDER=CBC.SCBCPRC
129//ZIP EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
130//    INFILE='prefix.ZIP.C(ZIP)',
131//    OUTFILE='prefix.ZIP.C.OBJ(ZIP),DISP=SHR',
132//    CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
133//    CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
134//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
135//CRYPT EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
136//    INFILE='prefix.ZIP.C(CRYPT)',
137//    OUTFILE='prefix.ZIP.C.OBJ(CRYPT),DISP=SHR',
138//    CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
139//    CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
140//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
141//TTYIO EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
142//    INFILE='prefix.ZIP.C(TTYIO)',
143//    OUTFILE='prefix.ZIP.C.OBJ(TTYIO),DISP=SHR',
144//    CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
145//    CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
146//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
147//TREES EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
148//    INFILE='prefix.ZIP.C(TREES)',
149//    OUTFILE='prefix.ZIP.C.OBJ(TREES),DISP=SHR',
150//    CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
151//    CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
152//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
153//DEFLATE EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
154//    INFILE='prefix.ZIP.C(DEFLATE)',
155//    OUTFILE='prefix.ZIP.C.OBJ(DEFLATE),DISP=SHR',
156//    CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
157//    CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
158//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
159//FILEIO EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
160//    INFILE='prefix.ZIP.C(FILEIO)',
161//    OUTFILE='prefix.ZIP.C.OBJ(FILEIO),DISP=SHR',
162//    CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
163//    CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
164//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
165//GLOBALS EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
166//    INFILE='prefix.ZIP.C(GLOBALS)',
167//    OUTFILE='prefix.ZIP.C.OBJ(GLOBALS),DISP=SHR',
168//    CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
169//    CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
170//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
171//UTIL EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
172//    INFILE='prefix.ZIP.C(UTIL)',
173//    OUTFILE='prefix.ZIP.C.OBJ(UTIL),DISP=SHR',
174//    CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
175//    CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
176//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
177//CRC32 EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
178//    INFILE='prefix.ZIP.C(CRC32)',
179//    OUTFILE='prefix.ZIP.C.OBJ(CRC32),DISP=SHR',
180//    CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
181//    CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
182//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
183//CRCTAB EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
184//    INFILE='prefix.ZIP.C(CRCTAB)',
185//    OUTFILE='prefix.ZIP.C.OBJ(CRCTAB),DISP=SHR',
186//    CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
187//    CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
188//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
189//ZIPFILE EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
190//    INFILE='prefix.ZIP.C(ZIPFILE)',
191//    OUTFILE='prefix.ZIP.C.OBJ(ZIPFILE),DISP=SHR',
192//    CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
193//    CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
194//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
195//ZIPUP EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
196//    INFILE='prefix.ZIP.C(ZIPUP)',
197//    OUTFILE='prefix.ZIP.C.OBJ(ZIPUP),DISP=SHR',
198//    CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
199//    CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
200//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
201//CMSMVS EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
202//    INFILE='prefix.ZIP.C(CMSMVS)',
203//    OUTFILE='prefix.ZIP.C.OBJ(CMSMVS),DISP=SHR',
204//    CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
205//    CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
206//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
207//MVS EXEC EDCC,COND=(0,NE),CREGSIZ='4M',
208//    INFILE='prefix.ZIP.C(MVS)',
209//    OUTFILE='prefix.ZIP.C.OBJ(MVS),DISP=SHR',
210//    CPARM='LONG,NOTERM,LIST,XREF,SOURCE',
211//    CPARM2='OPT(2),DEF(MVS),NOMAR,NOSEQ,CSECT'
212//COMPILE.USERLIB DD DSN=prefix.ZIP.H,DISP=SHR
213//PLINK   EXEC  PROC=EDCPL,
214//    OUTFILE='prefix.ZIP.LOAD(ZIP),DISP=SHR',
215//    PREGSIZ=6M,
216//    PPARM='NONCAL,MAP,MEMORY',
217//    LPARM='LIST,MAP,XREF'
218//PLKED.SYSIN   DD  DISP=SHR,DSN=prefix.ZIP.C.OBJ(ZIP)
219//              DD  DISP=SHR,DSN=prefix.ZIP.C.OBJ(CRYPT)
220//              DD  DISP=SHR,DSN=prefix.ZIP.C.OBJ(TREES)
221//              DD  DISP=SHR,DSN=prefix.ZIP.C.OBJ(DEFLATE)
222//              DD  DISP=SHR,DSN=prefix.ZIP.C.OBJ(FILEIO)
223//              DD  DISP=SHR,DSN=prefix.ZIP.C.OBJ(GLOBALS)
224//              DD  DISP=SHR,DSN=prefix.ZIP.C.OBJ(UTIL)
225//              DD  DISP=SHR,DSN=prefix.ZIP.C.OBJ(CRC32)
226//              DD  DISP=SHR,DSN=prefix.ZIP.C.OBJ(CRCTAB)
227//              DD  DISP=SHR,DSN=prefix.ZIP.C.OBJ(ZIPFILE)
228//              DD  DISP=SHR,DSN=prefix.ZIP.C.OBJ(ZIPUP)
229//              DD  DISP=SHR,DSN=prefix.ZIP.C.OBJ(MVS)
230//              DD  DISP=SHR,DSN=prefix.ZIP.C.OBJ(CMSMVS)
231//LKED.SYSLIB   DD  DISP=SHR,DSN=CEE.SCEELKED
232//SYSUT1   DD  UNIT=SYSDA,SPACE=(CYL,(2,2))
233//
234
235Sample JCL to zip the mainframe .C and .H files as ASCII (-a).  Delete
236any existing archive first, point the temporary file at a particular
237prefix (-b), use 'prefix.ARCHIVE.ZIP' for the archive file, read the
238list of files to zip from stdin (SYSIN).
239
240//DELETE  EXEC PGM=IDCAMS
241//SYSPRINT DD  SYSOUT=*
242//SYSIN    DD  *
243 DELETE prefix.ARCHIVE.ZIP
244 SET MAXCC = 0
245//ZIP     EXEC PGM=ZIP,
246// PARM='/-a -v -b temppref ''prefix.ARCHIVE.ZIP'' -@'
247//STEPLIB  DD  DSN=prefix.ZIP.LOAD,DISP=SHR
248//SYSPRINT DD  SYSOUT=*
249//SYSOUT   DD  SYSOUT=*
250//CEEDUMP  DD  SYSOUT=*
251//ZIPC     DD  DISP=SHR,DSN=prefix.ZIP.C
252//ZIPH     DD  DISP=SHR,DSN=prefix.ZIP.H
253//SYSIN    DD  *
254dd:zipc(api)
255dd:zipc(cms)
256dd:zipc(cmsmvs)
257dd:zipc(crctab)
258dd:zipc(crc32)
259dd:zipc(crypt)
260dd:zipc(deflate)
261dd:zipc(fileio)
262dd:zipc(globals)
263dd:zipc(mktime)
264dd:zipc(mvs)
265dd:zipc(trees)
266dd:zipc(ttyio)
267dd:zipc(util)
268dd:zipc(zip)
269dd:zipc(zipcloak)
270dd:zipc(zipfile)
271dd:zipc(zipnote)
272dd:zipc(zipsplit)
273dd:zipc(zipup)
274dd:ziph(api)
275dd:ziph(cmsmvs)
276dd:ziph(crypt)
277dd:ziph(cstat)
278dd:ziph(ebcdic)
279dd:ziph(mvs)
280dd:ziph(revision)
281dd:ziph(stat)
282dd:ziph(tailor)
283dd:ziph(ttyio)
284dd:ziph(zip)
285dd:ziph(ziperr)
286dd:ziph(zipup)
287