Qus_Vlen_Rec_4_t CCSID_rec;

intCCSID; Qus_Vlen_Rec_4_t desc_rec;

chardesc[1ðð]; } addep_attributes;

/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

/\

 

\/

/\

main

\/

/\

 

\/

/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/ int main()

{

error_code_struct error_code; addep_attributes attrib_keys;

/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

/\ Initialize the error code parameter.\/ /\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/ error_code.ec_fields.Bytes_Provided=sizeof(error_code_str￿uct);

/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

/\ Set

the

total

number of exit program

attributes that we a￿re

\/

/\

specifying on

the call.

We will let

the API take the default

\/

/\

for

the

attributes that

we are not specifying.

\/

/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/ attrib_keys.num_rec=3;

/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

/\ Set the values for

the three attributes that we will be

\/

/\ specifying:

 

 

 

 

\/

/\

Replace exit

program

=

1

(CHAR(1) field)

\/

/\

Exit program

data CCSID =

37

(BIN(4) field)

\/

/\

Exit program

description='THIS IS A TEST EXIT PROGRAM'

\/

/\

 

 

 

 

(CHAR(5ð) field)

\/

/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

attrib_keys.replace_rec.Length_Vlen_Record=16; .17/ attrib_keys.replace_rec.Control_Key=4; attrib_keys.replace_rec.Length_Data=1; attrib_keys.replace='1';

attrib_keys.CCSID_rec.Length_Vlen_Record=16; attrib_keys.CCSID_rec.Control_Key=3; attrib_keys.CCSID_rec.Length_Data=4; attrib_keys.CCSID=37;

attrib_keys.desc_rec.Length_Vlen_Record=39; attrib_keys.desc_rec.Control_Key=2; attrib_keys.desc_rec.Length_Data=27; memcpy(&attrib_keys.desc,"THIS IS A TEST EXIT PROGRAM",27);

/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

/\ Call the API to add the exit program.\/ /\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/ QusAddExitProgram("EXAMPLE_EXIT_POINT ",

"EXMPð1ðð",

1,

"EXAMPLEPGMEXAMPLELIB", "EXAMPLE EXIT PROGRAM DATA", 25,

&attrib_keys, &error_code);

if (error_code.ec_fields.Bytes_Available != ð)

{

printf("ATTEMPT TO ADD AN EXIT PROGRAM FAILED WITH EXCEPT￿ION: %.7s", error_code.ec_fields.Exception_Id);

exit(1);

}

} /\ end program \/

9-26System API Programming V4R1

Page 232
Image 232
IBM Version 4 manual EXAMPLEPGMEXAMPLELIB, Example Exit Program Data