Re: Assigns in Initializer
- From: gunnar.tapper@xxxxxx
- Date: 12 Jul 2006 13:22:08 -0700
Some code excerpts that might help you:
STRING c_assign_table = 'P' :=
[
c_assign_collector_fname,13,"EMS-COLLECTOR",
c_assign_ecp_fname ,11,"ECP-PROCESS",
c_null,c_null
];
status := INITIALIZER( !rucb!
, !passthru!
, Catch_startup_message
, Catch_startup_param
, Catch_startup_assign
, flags
, timelimit
);
PROC Catch_startup_assign( rucb, passthru, message, msglen, match )
VARIABLE;
INT .rucb;
INT .passthru;
INT .message;
INT msglen;
INT match;
BEGIN
INT .assign_msg( assign_msg_def ) := @message;
!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=!
!-=-=-=-=-=-=-=-=-=-= ** Procedure starts here **
=-=-=-=-=-=-=-=-=-=-=-=-=!
!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=!
!--------------------------------------------------------------------------!
! Loop thru the 'c_assign_table'.
!
!--------------------------------------------------------------------------!
USE i;
i := 0;
WHILE c_assign_table[i] DO
BEGIN
!-----------------------------------------------------------------------!
! The layout of the c_assign_table is as follows:
!
!
!
!
----------------------------------------------------------------- !
! | ID | LENGTH | VALUE
| !
!
----------------------------------------------------------------- !
!
!
! We're simply matching the length+value part of the table with
the !
! length+value of the passed assign
('assign_msg.logicalunit.filename' !
! consist of 1 byte for the length and up to 30 bytes for the
name). !
!-----------------------------------------------------------------------!
IF ( assign_msg.logicalunit.filename = c_assign_table[i+1] FOR
assign_msg.logicalunit.filename + 1 BYTES ) THEN
BEGIN
!--------------------------------------------------------------------!
! We found a match. Get the value and return.
!
!--------------------------------------------------------------------!
CALL Catch_assign_values( c_assign_table[i], assign_msg.values
);
RETURN;
END; ! of IF ( assign_msg.logicalunit ....
!-----------------------------------------------------------------------!
! Calculate a new value for 'i' using the length data found in
the !
! 'c_assign_table'. Remember to add a value of 2 to allow for the
ID !
! and LENGTH part of the table.
!
!-----------------------------------------------------------------------!
i := i + ( c_assign_table[i+1] + 2 );
END; ! of WHILE c_assign_table[i] DO
DROP i;
END; ! of PROC Catch_startup_assign
PROC Catch_assign_values( assign_id, assign_values );
INT assign_id;
INT .assign_values;
BEGIN
INT .assigned( assign_values_def ) := @assign_values;
STRUCT .fcbarea ( fcb_def );
INT .fcb( fcb_def ) := @fcbarea;
INT error := c_ok;
!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=!
!-=-=-=-=-=-=-=-=-=-= ** Procedure starts here **
=-=-=-=-=-=-=-=-=-=-=-=-=!
!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=!
!--------------------------------------------------------------------------!
! Initialize FCB.
!
!--------------------------------------------------------------------------!
fcb ':=' c_null & fcb FOR ( ( __Sizeof( fcb ) - 2 ) / 2 );
!--------------------------------------------------------------------------!
! Load assign filename.
!
!--------------------------------------------------------------------------!
IF ( assigned.fieldmask.<0> ) THEN
BEGIN
error := OLDFILENAME_TO_FILENAME_(assigned.physicalfilename,
fcb.fname:__Sizeof( fcb.fname
),
fcb.flen
);
IF ( error ) THEN
BEGIN
END; ! of IF ( error )
END; ! IF ( assigned.fieldmask.<0> )
!--------------------------------------------------------------------------!
! Load correct FCB and validate input.
!
!--------------------------------------------------------------------------!
CASE ( assign_id ) OF
BEGIN
c_assign_collector_fname ->
!--------------------------------------------------------------------!
! Check whether we have the define for the collector already.
If so, !
! the below processing is not necessary.
!
!--------------------------------------------------------------------!
IF ( g_have_collector_define = c_true ) THEN
RETURN;
!--------------------------------------------------------------------!
! Move the filename from the temporary FCB into the
'g_collector' !
! structure. Change the address of the temporary data
structure to !
! point to the 'g_collector' data structure. This makes it
easier !
! for us to write generic code AFTER the CASE statement.
!
!--------------------------------------------------------------------!
g_collector.fname ':=' fcb.fname FOR fcb.flen BYTES;
g_collector.flen := fcb.flen;
@fcb := @g_collector;
!--------------------------------------------------------------------!
! Check whether the name of the collector is a valid EMS
collector. !
!--------------------------------------------------------------------!
error := Invalid_EMS_collector(
g_collector.fname:g_collector.flen );
IF ( error ) THEN
BEGIN
!-----------------------------------------------------------------!
! We'll defer the logging until we're done with startup
!
! processing. We must do the check to see if we have a
previous !
! error to ensure that we didn't encounter an error before
this !
! error. This is done so we log the first error.
!
!-----------------------------------------------------------------!
IF ( g_error = c_ok ) THEN
BEGIN
END; ! of IF ( g_error = c_ok )
END; ! of IF ( error )
c_assign_ecp_fname ->
!--------------------------------------------------------------------!
! Move the filename from the temporary FCB into the 'g_ecp'
!
! structure. Change the address of the temporary data
structure to !
! point to the 'g_collector' data structure. This makes it
easier !
! for us to write generic code AFTER the CASE statement.
!
!--------------------------------------------------------------------!
g_ecp.fname ':=' fcb.fname FOR fcb.flen BYTES;
g_ecp.flen := fcb.flen;
@fcb := @g_ecp;
OTHERWISE ->
!--------------------------------------------------------------------!
! Unknown assign.
!
!--------------------------------------------------------------------!
RETURN;
END; ! of CASE ( assign_id ) OF
END; ! of PROC Catch_assign_values
TandemQuest wrote:
Hello all
I am using the INITIALIZER guardian call with assignproc, is it
possible to have more than one assign? if so, how to get each assigns?
Is it delimited by a delimiter? If any of you throw more light on this
it would be great. Thanks.
.
- References:
- Assigns in Initializer
- From: TandemQuest
- Assigns in Initializer
- Prev by Date: Re: PNUTS (pac.nw.users) midday July 26
- Next by Date: Re: Assigns in Initializer
- Previous by thread: Re: Assigns in Initializer
- Next by thread: PNUTS (pac.nw.users) midday July 26
- Index(es):
Relevant Pages
|