Function SETWEBS
********** COMMENT(=======================================================);
********** COMMENT(Copyright .....: (C) = LANSA SET Team =);
********** COMMENT(Process .......: S_SYSVAR);
********** COMMENT(Function ......: SETWEBS);
********** COMMENT(Type ..........: System Variable Evaluator);
********** COMMENT(Created by ....: SETUSER);
********** COMMENT(Created on ....: 25/05/00 at 10:58:30);
********** COMMENT(Description ...: This is a general purpose system);
********** COMMENT(variable evaluation program. It will set the value of);
********** COMMENT(any system variable that has been added to the file);
********** COMMENT(SETSV);
********** COMMENT(=======================================================);
********** COMMENT(Function Mainline : SETWEBS);
********** COMMENT(=======================================================);
********** COMMENT();
FUNCTION OPTIONS(*DIRECT *NOMESSAGES *LIGHTUSAGE *ALP_SYSTEM_VARIABLE);
********** COMMENT();
DEFINE FIELD(#S_SVCHVWK) REFFLD(#S_SVCHVAL);
********** COMMENT();
********** COMMENT();
********** COMMENT();
DEF_COND NAME(*AS400) COND('*CPUTYPE = AS400');
********** COMMENT();
IF COND(*AS400);
CHANGE FIELD(#S_SVCHVAL) TO(*NULL);
FETCH FIELDS(#S_SVCHVAL) FROM_FILE(SETSV) WITH_KEY(#SYSVAR$NM);
CHANGE FIELD(#SYSVAR$AV) TO(#S_SVCHVAL);
********** COMMENT();
********** COMMENT(Special Cases);
********** COMMENT();
CASE OF_FIELD(#SYSVAR$NM);
WHEN VALUE_IS('= ''*S_IFSPATH''');
********** COMMENT(This information may have been specified during import);
********** COMMENT(and stored in data area S_IMGDIR);
CHANGE FIELD(#S_SVCHVWK) TO(*NULL);
USE BUILTIN(GET_CHAR_AREA) WITH_ARGS('S_IMGDIR' *PARTDTALIB) TO_GET(#S_SVCHVWK);
IF COND('#S_SVCHVWK *NE *BLANKS');
********** COMMENT(Use the path specified during import);
CHANGE FIELD(#S_SVNAME) TO(#SYSVAR$NM);
CHANGE FIELD(#S_SVCHVAL) TO(#S_SVCHVWK);
CHANGE FIELD(#SYSVAR$AV) TO(#S_SVCHVWK);
CHECK_FOR IN_FILE(SETSV) WITH_KEY(#S_SVNAME);
IF_STATUS IS(*EQUALKEY);
UPDATE FIELDS(#S_SVCHVAL) IN_FILE(SETSV) WITH_KEY(#S_SVNAME);
ELSE;
INSERT FIELDS((#S_SVNAME)(#S_SVCHVAL)) TO_FILE(SETSV);
ENDIF;
USE BUILTIN(PUT_CHAR_AREA) WITH_ARGS(*BLANKS 'S_IMGDIR' *PARTDTALIB);
ENDIF;
ENDCASE;
********** COMMENT();
ELSE;
********** COMMENT(running on a PC which needs to get the value for the);
********** COMMENT(system variable from the AS/400);
IF COND('*SSERVER_CONNECTED *EQ Y');
EXCHANGE FIELDS(#SYSVAR$NM);
USE BUILTIN(CALL_SERVER_FUNCTION) WITH_ARGS(*SSERVER_SSN SETWEBP Y Y) TO_GET(#S_RETCDA2);
********** COMMENT(get back #SYSVAR$AV with the correct value for the);
********** COMMENT(system variable exchanged);
ELSE;
********** COMMENT(not connected - set system variable to blank);
CHANGE FIELD(#SYSVAR$AV) TO('''Not available''');
ENDIF;
ENDIF;
RETURN;
********** COMMENT(=======================================================);
********** COMMENT(Copyright .....: (C) = LANSA SET Team =);
********** COMMENT(Process .......: S_SYSVAR);
********** COMMENT(Function ......: SETWEBS);
********** COMMENT(Type ..........: System Variable Evaluator);
********** COMMENT(Created by ....: SETUSER);
********** COMMENT(Created on ....: 25/05/00 at 10:58:30);
********** COMMENT(Description ...: This is a general purpose system);
********** COMMENT(variable evaluation program. It will set the value of);
********** COMMENT(any system variable that has been added to the file);
********** COMMENT(SETSV);
********** COMMENT(=======================================================);
********** COMMENT(Function Mainline : SETWEBS);
********** COMMENT(=======================================================);
********** COMMENT();
FUNCTION OPTIONS(*DIRECT *NOMESSAGES *LIGHTUSAGE *ALP_SYSTEM_VARIABLE);
********** COMMENT();
DEFINE FIELD(#S_SVCHVWK) REFFLD(#S_SVCHVAL);
********** COMMENT();
********** COMMENT();
********** COMMENT();
DEF_COND NAME(*AS400) COND('*CPUTYPE = AS400');
********** COMMENT();
IF COND(*AS400);
CHANGE FIELD(#S_SVCHVAL) TO(*NULL);
FETCH FIELDS(#S_SVCHVAL) FROM_FILE(SETSV) WITH_KEY(#SYSVAR$NM);
CHANGE FIELD(#SYSVAR$AV) TO(#S_SVCHVAL);
********** COMMENT();
********** COMMENT(Special Cases);
********** COMMENT();
CASE OF_FIELD(#SYSVAR$NM);
WHEN VALUE_IS('= ''*S_IFSPATH''');
********** COMMENT(This information may have been specified during import);
********** COMMENT(and stored in data area S_IMGDIR);
CHANGE FIELD(#S_SVCHVWK) TO(*NULL);
USE BUILTIN(GET_CHAR_AREA) WITH_ARGS('S_IMGDIR' *PARTDTALIB) TO_GET(#S_SVCHVWK);
IF COND('#S_SVCHVWK *NE *BLANKS');
********** COMMENT(Use the path specified during import);
CHANGE FIELD(#S_SVNAME) TO(#SYSVAR$NM);
CHANGE FIELD(#S_SVCHVAL) TO(#S_SVCHVWK);
CHANGE FIELD(#SYSVAR$AV) TO(#S_SVCHVWK);
CHECK_FOR IN_FILE(SETSV) WITH_KEY(#S_SVNAME);
IF_STATUS IS(*EQUALKEY);
UPDATE FIELDS(#S_SVCHVAL) IN_FILE(SETSV) WITH_KEY(#S_SVNAME);
ELSE;
INSERT FIELDS((#S_SVNAME)(#S_SVCHVAL)) TO_FILE(SETSV);
ENDIF;
USE BUILTIN(PUT_CHAR_AREA) WITH_ARGS(*BLANKS 'S_IMGDIR' *PARTDTALIB);
ENDIF;
ENDCASE;
********** COMMENT();
ELSE;
********** COMMENT(running on a PC which needs to get the value for the);
********** COMMENT(system variable from the AS/400);
IF COND('*SSERVER_CONNECTED *EQ Y');
EXCHANGE FIELDS(#SYSVAR$NM);
USE BUILTIN(CALL_SERVER_FUNCTION) WITH_ARGS(*SSERVER_SSN SETWEBP Y Y) TO_GET(#S_RETCDA2);
********** COMMENT(get back #SYSVAR$AV with the correct value for the);
********** COMMENT(system variable exchanged);
ELSE;
********** COMMENT(not connected - set system variable to blank);
CHANGE FIELD(#SYSVAR$AV) TO('''Not available''');
ENDIF;
ENDIF;
RETURN;