Re: Thanks for the info on *USRQs; now a question about LOCK/UNLOCK
Dave McKenzie <[email protected]>
| Newsgroups | gmane.comp.lang.as400.mi |
|---|---|
| Message-ID | <[email protected]> |
No, ILE CL can have only 1 procedure per module. So if you need
multiple functions, two methods that suggest themselves are multiple CL
modules, or what I usually use, the simple-minded method (see below).
Here's the earliest manual I could find (V4R2):
http://publib.boulder.ibm.com/cgi-bin/bookmgr/docnum/sc41-5721-01
--Dave
-------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void CLMOD( void *, void *, void *, void *, void *);
void main(int argc, char *argv[])
{
char obj[10] = "AFILE ";
char lib[10] = "MYLIB ";
char type[7] = "*FILE ";
char state[7] = "*EXCLRD";
CLMOD("ALLOC ", obj, lib, type, state);
/* some stuff */
CLMOD("DEALLOC ", obj, lib, type, state);
return;
}
The CLMOD:
------------------------------------------------------------
PGM PARM(&OPER &NAME &LIB &TYPE &STATE)
DCL VAR(&OPER ) TYPE(*CHAR) LEN( 8)
DCL VAR(&NAME ) TYPE(*CHAR) LEN(10)
DCL VAR(&LIB ) TYPE(*CHAR) LEN(10)
DCL VAR(&TYPE ) TYPE(*CHAR) LEN( 7)
DCL VAR(&STATE ) TYPE(*CHAR) LEN( 7)
IF COND(&OPER *EQ 'ALLOC ') THEN(GOTO ALLOC)
IF COND(&OPER *EQ 'DEALLOC ') THEN(GOTO DEALLOC)
GOTO CMDLBL(ENDPGM)
/*-------------------*/
ALLOC:
ALCOBJ OBJ((&LIB/&NAME &TYPE &STATE))
GOTO CMDLBL(ENDPGM)
/*-------------------*/
DEALLOC:
DLCOBJ OBJ((&LIB/&NAME &TYPE &STATE))
GOTO CMDLBL(ENDPGM)
/*-------------------*/
ENDPGM:
ENDPGM
James H H Lampert wrote:
> Dave McKenzie <[email protected]> wrote:
>> What I usually do is create an ILE CL module with all the CL commands
>> I want to do and bind it with the C module. Then call it like a
>> function, passing parms to the commands.
>
> Hmm. Can you point me to an example of this? Up until about 10 minutes
> ago, I didn't know ILE CL was available far enough back to work in my
> situation.
>
> I'm having trouble locating docs on what ILE CL can do. Can it do
> multiple procedures in a module?
>
> --
> JHHL
>
_______________________________________________
This is the MI Programming on the AS400 / iSeries (MI400) mailing list
To post a message email: MI400-Zwy7GipZuJhWk0Htik3J/[email protected]
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/mi400
or email: MI400-request-Zwy7GipZuJhWk0Htik3J/[email protected]
Before posting, please take a moment to review the archives
at http://archive.midrange.com/mi400.