Function SET178A Generate Static HTML pages

LANSA

Function SET178A Generate Static HTML pages

********** COMMENT(=======================================================);
********** COMMENT(Process ........: SET_178);
********** COMMENT(Function .......: SET178A);
********** COMMENT(Created on .....: 18/05/00 at 14:43:32);
********** COMMENT(Description ....: Generate all static pages);
********** COMMENT(Version.........: 1);
********** COMMENT();
********** COMMENT(Full Description: The purpose of this function is to);
********** COMMENT(generate the all the static pages);
********** COMMENT();
********** COMMENT(Disclaimer: The following material is supplied as an);
********** COMMENT(example only. No warranty is expressed or implied.);
********** COMMENT();
********** COMMENT(=======================================================);
********** COMMENT(Function control options);
FUNCTION OPTIONS(*DIRECT);
********** COMMENT();
********** COMMENT(<RDML ONCONDITION> field.);
********** COMMENT(Group and field definitions);
********** COMMENT();
DEFINE FIELD(#S_178POS) TYPE(*DEC) LENGTH(003) DECIMALS(0);
********** COMMENT();
********** COMMENT(Mainline);
********** COMMENT();
REQUEST FIELDS((#S_IFSPATH)(#S_HOSTPRT)(#S_HOSTURL)) DESIGN(*DOWN) IDENTIFY(*DESC);
BEGINCHECK;
********** COMMENT(Reject IFS Path if it contains quotes);
USE BUILTIN(SCANSTRING) WITH_ARGS(#S_IFSPATH #QUOTE) TO_GET(#S_178POS);
IF COND('#S_178POS *GT 0');
SET_ERROR FOR_FIELD(#S_IFSPATH) MSGTXT('The IFS Path must not include quotes');
ENDIF;
ENDCHECK;
********** COMMENT(Check for changes in #S_IFSPATH #S_HOSTPRT #S_HOSTURL);
EXECUTE SUBROUTINE(CHK_SYSVAR);
********** COMMENT();
********** COMMENT(Assign unique identifying pages to all:);
********** COMMENT(brands);
********** COMMENT(device types);
********** COMMENT(device sub-types);
********** COMMENT(brand-device types);
********** COMMENT(brand-device subtypes);
********** COMMENT();
********** COMMENT(Brands);
DEFINE FIELD(#S_178IDN) TYPE(*DEC) LENGTH(005) DECIMALS(0);
CHANGE FIELD(#S_178IDN) TO(0);
SELECT FIELDS(#S_178BRND) FROM_FILE(SETBRD);
CHANGE FIELD(#S_178IDN) TO('#S_178IDN + 1');
EXECUTE SUBROUTINE(URL) WITH_PARMS(#S_178IDN #S_178BPG);
UPDATE FIELDS(#S_178BPG) IN_FILE(SETBRD);
ENDSELECT;
********** COMMENT(Device Types (desktops, notebooks, modems etc));
SELECT FIELDS(#S_178DVTP) FROM_FILE(SETDEV);
********** COMMENT(Certain devicetypes have constant page names so that);
********** COMMENT(the left hand side menu can refer to them.);
CASE OF_FIELD(#S_178DVTP);
WHEN VALUE_IS('= ''desktops''');
CHANGE FIELD(#S_178DVPG) TO(S_178DKTP);
WHEN VALUE_IS('= ''notebooks''');
CHANGE FIELD(#S_178DVPG) TO(S_178NTBK);
WHEN VALUE_IS('= ''printers''');
CHANGE FIELD(#S_178DVPG) TO(S_178PRNT);
WHEN VALUE_IS('= ''modems''');
CHANGE FIELD(#S_178DVPG) TO(S_178MODM);
WHEN VALUE_IS('= ''hard disk drives''');
CHANGE FIELD(#S_178DVPG) TO(S_178HDSK);
OTHERWISE;
CHANGE FIELD(#S_178IDN) TO('#S_178IDN + 1');
EXECUTE SUBROUTINE(URL) WITH_PARMS(#S_178IDN #S_178DVPG);
ENDCASE;
UPDATE FIELDS(#S_178DVPG) IN_FILE(SETDEV);
ENDSELECT;
********** COMMENT(Device Sub-Types (SCSI hard disks, laserjet printers..));
SELECT FIELDS(#S_178SBTP) FROM_FILE(SETSUB);
CHANGE FIELD(#S_178IDN) TO('#S_178IDN + 1');
EXECUTE SUBROUTINE(URL) WITH_PARMS(#S_178IDN #S_178SBPG);
UPDATE FIELDS(#S_178SBPG) IN_FILE(SETSUB);
ENDSELECT;
********** COMMENT(Brand-Device Types (hp printers, toshiba notebooks..));
********** COMMENT(create link records and assign a unique page to each);
GROUP_BY NAME(#S_GRPLNK) FIELDS((#S_178LNKT)(#S_178DVTP)(#S_178SBTP)(#S_178BRND)(#S_178LNPG)(#S_178LIMG));
DELETE FROM_FILE(SETLNKL1) WITH_KEY(BD);
CHANGE FIELD(#S_GRPLNK) TO(*NULL);
CHANGE FIELD(#S_178LNKT) TO(BD);
********** COMMENT();
SELECT FIELDS((#S_178DVTP)(#S_178BRND)) FROM_FILE(SETPRDL1);
FETCH FIELDS(#STD_TEXT) FROM_FILE(SETLNKL1) WITH_KEY(BD #S_178BRND #S_178DVTP) KEEP_LAST(00001);
IF_STATUS IS_NOT(*OKAY);
********** COMMENT(a link has not yet been created for this brand &);
********** COMMENT(device type: create it.);
CHANGE FIELD(#S_178IDN) TO('#S_178IDN + 1');
EXECUTE SUBROUTINE(URL) WITH_PARMS(#S_178IDN #S_178LNPG);
INSERT FIELDS(#S_GRPLNK) TO_FILE(SETLNK);
ENDIF;
ENDSELECT;
********** COMMENT(Brand-Device Sub-Types);
********** COMMENT(hp laser jet printers, toshiba TFT laptops,...);
********** COMMENT(create link records and assign a unique page to each);
DELETE FROM_FILE(SETLNKL1) WITH_KEY(BS);
CHANGE FIELD(#S_GRPLNK) TO(*NULL);
CHANGE FIELD(#S_178LNKT) TO(BS);
********** COMMENT();
SELECT FIELDS((#S_178DVTP)(#S_178SBTP)(#S_178BRND)) FROM_FILE(SETPRDL1);
FETCH FIELDS(#STD_TEXT) FROM_FILE(SETLNKL1) WITH_KEY(BS #S_178BRND #S_178DVTP #S_178SBTP) KEEP_LAST(00001);
IF_STATUS IS_NOT(*OKAY);
********** COMMENT(a link has not yet been created for this brand &);
********** COMMENT(device subtype: create it.);
CHANGE FIELD(#S_178IDN) TO('#S_178IDN + 1');
EXECUTE SUBROUTINE(URL) WITH_PARMS(#S_178IDN #S_178LNPG);
INSERT FIELDS(#S_GRPLNK) TO_FILE(SETLNK);
ENDIF;
ENDSELECT;
********** COMMENT();
********** COMMENT(Product pages (Canon BJC3000 printer..etc));
SELECT FIELDS(#S_178PRD) FROM_FILE(SETPRD);
CHANGE FIELD(#S_178IDN) TO('#S_178IDN + 1');
EXECUTE SUBROUTINE(URL) WITH_PARMS(#S_178IDN #S_178PPG);
UPDATE FIELDS(#S_178PPG) IN_FILE(SETPRD);
ENDSELECT;
********** COMMENT();
********** COMMENT(Now Generate the pages);
********** COMMENT();
********** COMMENT(Generate the front page);
SUBMIT PROCESS(SET_178) FUNCTION(SET178B);
********** COMMENT();
********** COMMENT(Generate the Device-Type pages);
********** COMMENT(one page per Device-Type);
SELECT FIELDS(#S_178DVTP) FROM_FILE(SETDEV);
CHECK_FOR IN_FILE(SETPRDL2) WITH_KEY(#S_178DVTP);
IF_STATUS IS(*EQUALKEY);
EXCHANGE FIELDS(#S_178DVTP);
SUBMIT PROCESS(SET_178) FUNCTION(SET178C);
********** COMMENT(Generate Device Sub-Type pages);
********** COMMENT(One page per device sub-type);
SELECT FIELDS(#S_178SBTP) FROM_FILE(SETSUB) WITH_KEY(#S_178DVTP);
CHECK_FOR IN_FILE(SETPRDL2) WITH_KEY(#S_178DVTP #S_178SBTP);
IF_STATUS IS(*EQUALKEY);
EXCHANGE FIELDS(#S_178DVTP #S_178SBTP);
SUBMIT PROCESS(SET_178) FUNCTION(SET178D);
ENDIF;
ENDSELECT;
ENDIF;
ENDSELECT;
********** COMMENT(Generate the Brand pages);
********** COMMENT(one page per Brand);
SELECT FIELDS(#S_178BRND) FROM_FILE(SETBRD);
CHECK_FOR IN_FILE(SETPRDL1) WITH_KEY(#S_178BRND);
IF_STATUS IS(*EQUALKEY);
EXCHANGE FIELDS(#S_178BRND);
SUBMIT PROCESS(SET_178) FUNCTION(SET178E);
ENDIF;
ENDSELECT;
********** COMMENT(Generate the link pages);
********** COMMENT(BD: one page per Brand-device type);
********** COMMENT(BS: one page per Brand-sub type);
SELECT FIELDS(#S_GRPLNK) FROM_FILE(SETLNK);
CASE OF_FIELD(#S_178LNKT);
WHEN VALUE_IS('= BD');
EXCHANGE FIELDS(#S_178BRND #S_178DVTP);
SUBMIT PROCESS(SET_178) FUNCTION(SET178F);
WHEN VALUE_IS('= BS');
EXCHANGE FIELDS(#S_178BRND #S_178DVTP #S_178SBTP);
SUBMIT PROCESS(SET_178) FUNCTION(SET178G);
ENDCASE;
ENDSELECT;
********** COMMENT(Generate the Product Pages);
********** COMMENT((one page per Product);
SELECT FIELDS((#S_178PRD)(#S_178DVTP)(#S_178SBTP)) FROM_FILE(SETPRD);
EXCHANGE FIELDS(#S_178PRD #S_178DVTP #S_178SBTP);
SUBMIT PROCESS(SET_178) FUNCTION(SET178H);
ENDSELECT;
********** COMMENT();
********** COMMENT();
SUBROUTINE NAME(URL) PARMS((#S_178IDN) (#S_178DVPG));
CHANGE FIELD(#S_178DVPG) TO(*NULL);
SUBSTRING FIELD(#S_178IDN 1) INTO_FIELD(#S_178DVPG 1);
USE BUILTIN(TCONCAT) WITH_ARGS('S_178' #S_178DVPG) TO_GET(#S_178DVPG);
ENDROUTINE;
********** COMMENT();
SUBROUTINE NAME(CHK_SYSVAR);
********** COMMENT();
DEF_LIST NAME(#PARM_NAME) FIELDS(#S_SVNAME) TYPE(*WORKING);
DEF_LIST NAME(#PARM_VALU) FIELDS(#S_SVCHVAL) TYPE(*WORKING);
CLR_LIST NAMED(#PARM_VALU);
CLR_LIST NAMED(#PARM_NAME);
********** COMMENT();
********** COMMENT(Update system variables if changed);
IF COND('#S_IFSPATH *ne *S_IFSPATH');
CHANGE FIELD(#S_SVNAME) TO('''*S_IFSPATH''');
CHANGE FIELD(#S_SVCHVAL) TO(#S_IFSPATH);
ADD_ENTRY TO_LIST(#PARM_VALU);
ADD_ENTRY TO_LIST(#PARM_NAME);
ENDIF;
********** COMMENT();
IF COND('#s_hosturl *ne *s_hosturl');
CHANGE FIELD(#S_SVNAME) TO('''*S_HOSTURL''');
CHANGE FIELD(#S_SVCHVAL) TO(#S_HOSTURL);
ADD_ENTRY TO_LIST(#PARM_VALU);
ADD_ENTRY TO_LIST(#PARM_NAME);
ENDIF;
********** COMMENT();
IF COND('#s_hostprt *ne *s_hostport');
CHANGE FIELD(#S_SVNAME) TO('''*S_HOSTPORT''');
CHANGE FIELD(#S_SVCHVAL) TO(#S_HOSTPRT);
ADD_ENTRY TO_LIST(#PARM_VALU);
ADD_ENTRY TO_LIST(#PARM_NAME);
ENDIF;
********** COMMENT();
IF COND('(#s_hostprt *ne *s_hostport) or (#s_hosturl *ne *s_hosturl) or (#S_IFSPATH *ne *s_IFSPATH)');
CALL PROCESS(*DIRECT) FUNCTION(SETCHSV) PASS_LST(#PARM_NAME #PARM_VALU );
ENDIF;
********** COMMENT();
ENDROUTINE;