-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPCRDOC.SCRIPT
633 lines (618 loc) · 23 KB
/
PCRDOC.SCRIPT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
.*****************
.*
.* To format this file with Bookie:
.*
.* SCRIPT PCRDOC SCRIPT ( QUIET ,
.* PROFILE(EDFPRF40) ,
.* LIB(XGRAPHIC FPLPDF10 EDFLIB40) ,
.* SYSVAR (B SPINE V RCF G INLINE S OFFSET X YES Z YES),
.* SYSVAR(W' fn') ,
.* FONTLIB (FONTPS),
.* CONT ,
.* TWOPASS ,
.* DEVICE(PSA) ,
.* @BOOKFNT(3) ,
.* INDEX ,
.* @COREFNT(YES) ,
.*****************
:userdoc.
:prolog.
.nameit symbol=this text=PCR gmltype=pk
:docdesc id=pliref
num='https://www.ibm.com/support/pages/pli-mvs-vm-documentation-library'.
:ldesc id=pli docid=pliref object=none objtype=other.
:ldesc id=immd object=hdimmd.
:title stitle='PCR'.
:library.PCR
:topic.Guide and Reference
:release.Release 1.0
:etitle.
:date.&date. &time.
:eprolog.
:frontm.
:tipage.
:toc.
:body.
.** Intro
.**
:h1.Introduction to PL/I-CMS-Rexx (PCR)
.*
The &this. utility and related tools supports PL/I routines
to be nucxloaded into CMS storage and then invoked as either CMS commands,
Rexx functions and subroutines, or CMS "immediate" commands.
Multiple PL/I routines can be loaded and managed at once, all sharing
common data structures.
:p.
&this. is similar to the CMS :pk.NUCXLOAD:epk. and
:pk.NUCXDROP:epk. commands,
but is designed to work with
PL/I modules, and allows them to share data structures and retain
allocated data structures between invocations.
Modules
are given a logical name by which they are invoked, in addition to
a nucleus name (:hp1.nucxname:ehp1.) with which they are loaded. The logical
name can be
invoked either asa:
:ol.
:li.a Rexx function or subroutine,
:li.a normal CMS command, i.e. through the command line,
:li.a CMS immediate command,
:li.a subcommand environment handler.
:eol.
Examples of each of these are given below.
:p.
&this. makes creating these types of routines much easier as they can be now
written in PL/I instead of Assembler.
.********************************************
.** Syntax
.**
:h1. &this. Syntax
The syntax of the &this. command is:
:fig place=inline.
:syntax.
:kwd.PCR
:group choice req.
:group.
:kwd.LOAD
:var.logname
:group choice req.
:kwd.REXX
:kwd.CMSC
:kwd.SUBC
:kwd.IMMC
:egroup.
:var.nucxname
:group seq opt.
:var.modname
:group seq opt.
:var.loadlib
:egroup.
:egroup.
:group seq opt.
:kwd.(
:group seq req.
:group choice req.
:kwd.NOLOAD
:kwd.ENDCMD
:egroup.
:egroup.
:egroup.
:egroup.
:group.
:kwd.DROP
:group choice req.
:var.logname
:kwd. *
:egroup.
:egroup.
:kwd.RESET
:kwd.TERM
:egroup.
:esyntax.
:efig.
:p.
:h3.Operands
:dl compact.
:dt.LOAD
:dd.defines a logical name, binds it to a PL/I module, and load
that module as a CMS nucleus extension.
:dl.
:dt.logname
:dd.is the logical name of the subcommand, CMS command,
immediate Command or Rexx function/subroutine being defined, indicated
by the type (SUBC, CMSC, IMMC or REXX). The logname cannot be the same
as the nucxname. If a nucleus extension of this name already exists,
an error occurs.
:dt.REXX
:dd.the module will be invoked as a Rexx functio or subroutine
:dt.CMSC
:dd.the module will be invoked as a CMS command
:dt.SUBC
:dd.the module will be invoked as a CMS subcommand handler
:dt.IMMC
:dd.the module will be invoked as a CMS immediate command
:dt.nucxname
:dd.is the nucleus extension name which the PL/I module will be
loaded as. This can :hp2.NOT:ehp2. be the same as the logical name.
If a nucleus extension of this name already exists, a new copy will
NOT be loaded, although the definition of the logical name continues.
:dt.modname
:dd.is the name of the PL/I module. If omitted, an equal sign is
assumed which will indicate to use the nucxname as the modname.
:dt.loadlib
:dd.is the optional load library from which the PL/I module is
loaded.
:edl.
:dt.DROP
:dd.specifies to delete the logical name's definition. The PL/I programm
associated with the logical name is nucxdropped, only if it was
actually loaded when the logical name was defined.
If an asterisk is specified as the logical name, all
logical names will be dropped.
:dt.RESET
:dd.will delete all logical names, and any PL/I program loaded.
Since this type of call is made by CMS when a NUCXDROP &this. is issued,
the three Immediate Commands, (PTS, PTE, PHX) are also removed.
:dt.TERM
:dd.will call the PLISTART that is linked into the &this. module
to terminate the PL/I environment. This is also done when
CMS returns to "Ready", via ENDCMD processing. However, currently,
if TERM is done via ENDCMD, an abend occurs. Thus, all execs
invoking &this. PL/I modules that are compiled with the SYSTEM(MVS) option
should have a &this. TERM as the last command
so the environment does not get TERMed during ENDCMD processing.
No special provisions need be taken with PL/I modules compiled
with the default SYSTEM(CMS) option..
:dt.NOLOAD
:dd.specifies that no PL/I module is to be nucxloaded.
:dt.ENDCMD
:dd.specifies that the PL/I program is to be called when CMS returns
to the "Ready" state. Not valid for types IMMC and SUBC.
:edl.
.********************************************
.** Function lib
.********************************************
.** PCR Immeds
.**
:h1.Immediate Commands
.*
When the &this. program is used, three immediate commands are defined.
They each modify a bit within a byte which each PL/I program has
access to. They can be used, or ignored, depending on the PL/I program's
logic. They are:
:dl.
:dt.PTS
:dd.Trace Start. PL/I programs can check this flag to see if tracing
messages are produced.
:dt.PTE
:dd.Trace End. This will turn off the PTS bit.
:dt.PHX
:dd.Halt eXecution. PL/I programs can test this bit at critical
locations within the program's logic, and can thus support a controlled
shut down at the user's control. This bit is reset to false when
a PL/I program is first entered.
:edl.
:p.
:hp2.Note::ehp2.
CMS may not invoke immediate
commands during tight CPU loops. Some I/O or SVC must be issued before
CMS will look for immediate command. This author does not know all
the details as to when CMS will actually notice and respond to an
immediate command. See the section :l lid=immd.:hp2.Careful with
Immediate Commands:ehp2.:el. below for addtional information.
.********************************************
.** Runtime loading
.**
.** :h1.Loading PL/I Runtime Modules
.*
.** Upon first invocation of PCR, zero or more modules from PLILIB/IBMLIB
.** Loadlib are nucxloaded. The PCR code can be modified to list each
.** module to load from each of the two system loadlibs. Modify the tables
.** LPLITAB and LIBMTAB within the PCR Assemble file. An 'FF'x entry must
.** mark the end of the tables.
.********************************************
.** PCRCB
.**
:h1.PCR Run Time Enkvironment
:p. &this. provides a rune time environment that makes it easy for the
PL/I application to:
:ul.
:li.determine how it was invoked.
:li.access the PL/I program parameter list.
:li.maintain pointers to static storage areas for sharing data
between applications and across invocations.
:li.access Rexx arguments and return data back to calling Rexx execs.
:li.create and manage standard Rexx function libraries.
:eul.
:p. These capabilites are provided by two &this. control blocks, PCR Control Block
and the PCR EvalBlock, and the PCRRXFN assembler program.
:h2.PCR Control Block
.*
The PCR Control Block (PCRCB) is a data structure that contains
information about the service being loaded and defined. There
is one control block per successful :pk.PCR LOAD:epk.. The two members,
PCRCBA and PCRCBP, contained in the :pk.PCR MACLIB:epk. represent the
layout of the PCRCB for Assembler and PL/I.
:p.
The PCRCB_ptr will be passed as the first parameter to the PL/I
programs compiled with SYSTEM(MVS).
However, PL/I programs called thru &this. can also obtain the
address of the PCRCB by calling
the assembler routine PCRGETC, which is declared in the PCRCBP
member.
The PL/I definition of the PCR Control Block is:
:fig frame=box place=inline.
:xmp.
/* PCR Control Block */
Declare
PCRCB_ptr pointer,
PCRCB_arg_c256 char(256) based(PCRCB_arg_ptr),
PCRCB_arg_c32767 char(32767) based(PCRCB_arg_ptr),
1 PCRCB_struct based(PCRCB_ptr),
2 PCRCB_reserved pointer,
2 PCRCB_global_ptr pointer, /* STATIC to ALL PLI programs */
2 PCRCB_local_ptr pointer, /* STATIC for this PLI program */
2 PCRCB_arg_ptr pointer, /* Points to Argstring */
2 PCRCB_arg_len fixed bin(31), /*len of Argstring */
2 PCRCB_type char(4), /* IMMC, SUBC, CMSC, REXX */
2 PCRCB_name char(8), /* Name of PCR entry */
2 PCRCB_nucxname char(8), /* Nucname of PLI program */
2 PCRCB_modname char(8), /* Module name of PLI program */
2 PCRCB_loadlib char(8), /* Loadlib that PLI came from */
2 PCRCB_iflag_t bit(1), /* PTS IMMED is active (PTE off) */
2 PCRCB_iflag_hx bit(1), /* PHX IMMED is active */
2 PCRCB_iflag_dummy bit(6), /* more bit in IFLAG */
2 PCRCB_OPT_endcmd char(1), /* Y/N ENDCMD options specified */
2 PCRCB_OPT_noload char(1), /* Y/N NOLOAD options specified */
2 PCRCB_loaded char(1), /* Y/N A PLI Module was loaded */
2 PCRCB_spec_type char(1), /* blank, or E for Endcmd */
2 PCRCB_reserved2 char(2),
/* The RX fields are used only if called as Rexx Fun or Sub */
2 PCRCB_RX_type char(1), /* Fun or Sub */
2 PCRCB_RX_arglist pointer, /* Pointer to arguments */
2 PCRCB_RX_argcnt fixed bin(31), /* Number of Arguments */
2 PCRCB_RX_ev_ptr pointer, /* Pointer to PCREV */
2 PCRCB_RX_entry_eval pointer, /* routine to get more EV space */
2 PCRCB_STOR_OBTAIN pointer, /* routine to get memory */
2 PCRCB_STOR_RELEASE pointer; /* routine to free memory */
/* For accessing Rexx Arguments */
Declare
RXARG_ptr pointer, /* PCRCB_RX_ARGLIST */
RXARG_c1 char(1) based(RXARG_addr),
RXARG_c32767 char(32767) based(RXARG_addr),
RXARG_c256 char(256) based(RXARG_addr),
1 RXARG_struct based(RXARG_ptr),
2 RXARG_addr pointer, /* Pointer to string */
2 RXARG_len fixed bin(31); /* Length of string */
/* Before calling routines within PCRCB, You must do the following */
/* ENTRYADDR(PCRGETEV) = PCRCB_RX_entry_eval */
/* ENTRYADDR(PCRSTOR_OBTAIN) = PCRCB_STOR_OBTAIN */
/* ENTRYADDR(PCRSTOR_RELEASE) = PCRCB_STOR_RELEASE */
Declare
PCRGETC entry(*) options(INTER RETCODE ASSEMBLER),
PCRGETEV variable entry,
PCRSTOR_OBTAIN variable entry(fixed bin(31)) returns(pointer),
PCRSTOR_RELEASE variable entry(pointer);
:exmp.
:efig.
:p.
Below are the PL/I field
names and their meaning.
:dl tsize=2i.
:dt.PCRCB_reserved
:dd.is a reserved field that &this. uses to link all the PCRCBs together.
This should not be modified.
:dt.PCRCB_global_ptr
:dd.are four bytes that all PL/I programs called with &this. can share.
It's initial value is a PL/I NULL, and will retain its value between
calls. Any PL/I program changing this field will change it for all
PL/I programs, thus, this can be used to anchor data that multiple
PL/I programs share.
:dt.PCRCB_local_ptr
:dd.are four bytes that the PL/I program can modify. These four bytes
can point to data structures that remain allocated between calls.
It's initial value is a PL/I NULL, and will retain its value between
calls.
:dt.PCRCB_arg_ptr
:dd.is a pointer to the Argument String passed by CMS. This is
the same data as represented by the CHAR(100) VARYING parameter
received by the "main" program, but can be used to process more than
100 bytes. This is a PL/I NULL for Immediate Commands.
For Rexx Functions/Subroutines, this points to the name of the
function, not the string "REXX".
:dt.PCRCB_arg_len
:dd.is the length of data to which PCRCB_arg_ptr points. For Immediate
Commands, this is 0.
:dt.PCRCB_type
:dd.indicates how this PL/I prgram was defined via the &this. LOAD.
The type will be either :pk.CMSC, REXX, SUBC:epk. or :pk.IMMC:epk..
:dt.PCRCB_name
:dd.is the logical name specified by the &this. LOAD.
:dt.PCRCB_nucxname
:dd.is the name of which the PL/I program was loaded in the nucleus.
:dt.PCRCB_modname
:dd.is the name of the PL/I module.
:dt.PCRCB_loadlib
:dd.is the loadlib name from which the PL/I program was loaded. This is
blank if no loadlib was specified, or is NOLOAD, if the &this. LOAD was
issued with the NOLOAD option.
:dt.PCRCB_iflag_t
:dd.is a bit that is set to '1'b when the PTS immediate command
is issued, and set to '0'b when the PTE immediate command is issued.
:dt.PCRCB_iflag_hx
:dd.is a bit that is set to '1'b when the PHX immediate command
is issued. When a PL/I program is first called, this bit is '0'b.
:dt.PCRCB_OPT_endcmd
:dd.Is a Y/N flag indicating if the ENDCMD option was specified during
PCR LOAD.
:dt.PCRCB_OPT_noload
:dd.Is a Y/N flag indicating if the NOLOAD option was specified during
PCR LOAD.
:dt.PCRCB_loaded
:dd.Is a Y/N flag indicating if the PL/I module was nucxloaded during
PCR LOAD.
:dt.PCRCB_spec_type
:dd.Indicates the specific type of call. Either 'I', 'R', 'S', or
'C', indicating IMMC, REXX, SUBC or CMSC. Also
'E' indicates this is an ENDCMD processing invocation.
:dt.PCRCB_reserved2
:dd.is reserved for future use and must not be modified.
:edl.
:p.The PCRCB_RX* fields are used only for Rexx function or subroutine
calls. Their values are unpredictable for other types of invocations.
:dl tsize=2i.
:dt.PCRCB_RX_type
:dd.indicates if the PL/I program was called as a Rexx function ('F') or
a Rexx subroutine ('S').
:dt.PCRCB_RX_arglist
:dd.is a pointer to the list of arguments with which the Rexx function
or subroutine was invoked, or NULL of there are no arguments.
:dt.PCRCB_RX_argcnt
:dd.is an integer representing the number of arguments to which
PCRCB_RX_arglist points.
:dt.PCRCB_RX_ev_ptr
:dd.points to the current EvalBlock, used for returning data to the
Rexx program. Upon entry, the EvalBlock has room for returning 250
bytes of data, and has a length of zero.
:dt.PCRCB_RX_entry_eval
:dd.is the address of the routine to call to obtain a larger EvalBlock.
:dt.PCRCB_STOR_OBTAIN
:dd.is the address of the routine to call to obtain CMS storage.
:dt.PCRCB_STOR_RELEASE
:dd.is the address of the routine to call to release CMS storage
obtained from PCRCB_STOR_OBTAIN.
:edl.
.********************************************
.** PCREV
.**
:h2.PCR EvalBlock
.*
The PCR EvalBlock (PCREV) is a data structure used by Rexx functions
and subroutines to return data to Rexx. When called as a Rexx function
or subroutine, an initial EvalBlock that can hold up to 250 bytes is
allocated. The :pk.PCRCB_RX_ev_ptr:epk. within the PCRCB points to this
PCREV. To return data to Rexx, the PL/I program must set the
PCREV_data field to the return data.
If you wish not to return data, set PCREV_highlen to -1.
:p.
If a larger field is needed, the PCREV_newbytes field must be set to
the number of bytes needed, and the PCRCB_RX_entry_eval addresses
must be called. A new PCREV will be allocated, and the old one
freed. The used bytes within the old PCREV_data field will be
copied to the new PCREV_data field. After calling this routine,
you must use the new value within PCRCB_RX_ev_ptr to point to and
modify the new PCREV.
:p.
The following code will allocate a larger EvalBlock.
:p.
:fig frame=box place=inline.
:xmp.
&invellip.
/* Must do this since PL/I cannot call just a pointer value */
ENTRYADDR(PCRGETEV) = PCRCB_RX_entry_eval;
/* Assign 240 bytes at first */
PCREV_data = char_240;
/* Now we find out we need more room */
PCREV_newbytes = 500;
call PCRGETEV;
PCREV_ptr = PCRCB_RX_ev_ptr;
/* Move in 200 more bytes */
PCREV_data = PCREV_data || char_200;
&invellip.
:exmp.
:efig.
:p.
The members PCREVA and PCREVP of the &this. :pk.MACLIB:epk. define the PCREV
for Assembler and PL/I. The PL/I fields a listed and described below.
:p.
:dl tsize=2i.
:dt.PCREV_bytes
:dd.is the current size of the PCREV_data field. This must not be
modified. Upon entry, this is 250.
:dt.PCREV_newbytes
:dd.should be set to a value larger that PCREV_bytes, before the
PCRCB_RX_entry_eval program is called, so a new, larger PCREV can
be allocated. If set larger than 32767, care must be taken when
modifying PCREV_data, since PL/I cannot really support a character
varying string larger than 32767.
:dt.PCREV_highlen
:dd.is the high order byte of the length field for PCREV_data. This
is zero upon entry, and can be set to a negative number if no data
is to be returned.
:dt.PCREV_data
:dd.is the data being returned and is defined as a varying length
character string.
PCR actually uses the two bytes of the character varying length field
as the low order byte and the PCREV_highlen as the high order byte
making a 4 byte length field for PCREV_data.
:edl.
.**
:h2.Rexx Function Library Support
.*
The PCRRXFN assembler program is a Rexx Function Library which
can manage PL/I and Assembler Functions. The &this. command is issued
to load PL/I programs, and the CMS :pk.NUCXLOAD:epk. command is used to
load Assembler programs. This module (PCRRXFN) must be either renamed
to one of the 3 supported names (RXUSERFN, RXLOCFN or RXSYSFN), or
specified as an extension to one of those names. The PCRRXFN module
distributed with :hp2.PCR:hp0. supports extensions.
:p.
There are 4 tables within PCRRXFN that can be modified to indicate
the supported modules. The tables are:
:dl.
:dt.PACKTAB
:dd.Each entry in PACKTAB is another function package module that
will be loaded and called to see if they have the function that
is being requested by Rexx. Any number of function packages can thus
be listed and supported, much more than just RXUSERFN, RXLOCFN and
RXSYSFN that Rexx supports. Each entry in PACKTAB is a character 8
and the last entry must be an 8X'FF'.
:dt.XFUNTAB
:dd.Each entry in XFUNTAB represents a Rexx function and its
corresponding MODULE which can be NUCXLOADed (generally written in
Assembler). The entries are character 16, the first 8 bytes is
the name of the Rexx function (must begin with RX), and the last 8 bytes
is the name of the Module to be NUCXLOADed.
The last entry must be an 8X'FF'.
:dt.XPLITAB
:dd.Each entry in XPLITAB represents a Rexx function and its
corresponding MODULE which is loaded using PCR, thus the module should
be from a PL/I program.
The entries are character 24, the first 8 bytes is
the name of the Rexx function (must begin with RX), and the 2nd 8 bytes
is the nucxname of which the module (last 8 bytes) is loaded.
The last entry must be an 8X'FF'.
:dt.LFUNTAB
:dd.Each entry in LFUNTAB represents a Rexx function and its
corresponding address. The code for the function is internally linked
into PCRRXFN.
The entries are character 16, the first 8 bytes is
the name of the Rexx function (must begin with RX), and the next 4 bytes
is the relocatable address of the internally linked routine, and the
last 4 bytes is a flag which should be set to CL4'N'.
The last entry must be an 8X'FF'.
:edl.
:h1.Examples, Warnings, and Caveats
:p.Here are some examples of using the functionality of &this. along with some
warnings and caveats.
.********************************************
.**
:h2.PL/I Compilers Supported
:p. &this. works with the following IBM z/VM PL/I compilers:
:ul.
:li. :l lid=pli. PL/I for MVS and VM:el..
:li. OS PL/I Version 2 Release 3.
:eul.
.** PL/I Parameter List
:h2.PL/I Parameter List
.*
PL/I programs compiled with SYSTEM(CMS)
will receive the normal
CHAR(100) VARYING as the first and only parameter, where
programs compiled with SYSTEM(MVS) will receive a
pointer to the
PCRCB as the first/only parameter.
The pointer to PCRCB can also be obtained by calling
routine PCRGETC.
The use of PCRCB is required by
Rexx functions/subroutines, but is otherwise not necessary.
.********************************************
.** Accessing Rexx Parms
.**
:h2.Accessing Rexx Arguments
.*
When called as a Rexx function or sSubroutine, there are 0 or more
arguments, pointed to by PCRCB_RX_arglist. The following code
shows how to access them. The data
can be modified by the PL/I program, if needed - perhaps to translate
them to upper case.
:p.
:fig frame=box place=inline.
:xmp.
&invellip.
/* Get access to PCRCB (if not already done) */
call PCRGETC(PCRCB_ptr);
/* Loop thru the parms */
RXARG_ptr = PCRCB_RX_arglist;
do i=1 to PCRCB_RX_argcnt;
/* To access/test first character */
if RXARG_c1='*' ...
/* To access up to 256 bytes */
if SUBSTR(RXARG_c256,1,RXARG_len) ...
/* To access up to 32767 bytes */
/* (Less efficient, but more complete) */
if SUBSTR(RXARG_c32767,1,RXARG_len) ...
/* Move to next arg */
RXARG_ptr = RXARG_ptr + STORAGE(RXARG_struct);
end;
&invellip.
:exmp.
:efig.
.********************************************
.** Keeping data around between calls
.**
:h2.Keeping data around between calls
.*
Any static variables that the PL/I program alters will retain their last
value, between calls.
However,
any storage allocated via the standard PL/I :pk.ALLOCATE :epk. statement that the PL/I program does
not free will be freed for you when you return your caller.
Thus, to allocate and keep storage between calls, the PL/I program
must use an alternate ALLOC/FREE routines. &this. provides two
entry points, PCRSTOR_OBTAIN and PCRSTOR_RELEASE to allocate
and free CMS memory. The following code shows their use.
:p.
:fig frame=box place=inline.
:xmp.
&invellip.
/* Must modify the entry address for the PL/I entry variables */
ENTRYADDR(PCRSTOR_OBTAIN) = PCRCB_STOR_OBTAIN;
ENTRYADDR(PCRSTOR_RELEASE) = PCRCB_STOR_RELEASE;
/* Allocate 100000 bytes of storage */
ptr = PCRSTOR_OBTAIN(100000);
/* Or allocate enough to fill a structure */
ptr = PCRSTOR_OBTAIN(STORAGE(some_based_struct));
/* Save it until next call, method 1 */
some_static_ptr = ptr;
/* Save it until next call, method 2 */
PCRCB_local_ptr = ptr;
/* Allow other PL/Is routines to access it */
PCRCB_global_ptr = ptr;
&invellip.
/* Here's how to free it */
call PCRSTOR_RELEASE(ptr);
&invellip.
:exmp.
:efig.
.********************************************
.** Note on IMMEDs
.**
:h2 id=hdimmd.Careful with Immediate Commandss
.*
Defining PL/I as Immediate commands can cause problems, depending
on what the PL/I program is doing. No I/O should be done. Remember
that PL/I might need to load dynamic code from text/load libraries, which
would mean doing I/O.
.********************************************
.** MVS or CMS
.**
:h2.SYSTEM(MVS) verses SYSTEM(CMS)
.*
If your PL/I program is compiled with SYSTEM(MVS), it will
share a common PL/I environment with any other PL/I
SYSTEM(MVS) programs
managed by &this.,
thus making execution faster. This common runtime environment support
is based on the PL/I preinitialization interface provided in the
PL/I Version 2 Release 3 program product (5668-910).
If your PL/I program is compiled with SYSTEM(CMS), it will create and
use a new PL/I environment upon each call.
.********************************************
:h1.A Final Note
:p.Please send any comments, criticisms, requests for additional features,
suggestions, or questions to:
Dave Jones
:p.Thank you for your support.
:egdoc