Function SET175G Dynamic Service Schedule - all voyages
********** COMMENT(=======================================================);
********** COMMENT(Process ........: SET_175B);
********** COMMENT(Function .......: SET175G);
********** COMMENT(Created on .....: 18/05/00 at 14:43:32);
********** COMMENT(Description ....: Shipping - Generate Service Schedule);
********** COMMENT(Version.........: 1);
********** COMMENT();
********** COMMENT(Full Description: The purpose of this function is to);
********** COMMENT(dynamically display the schedule for a service);
********** COMMENT();
********** COMMENT(Disclaimer: The following material is supplied as an);
********** COMMENT(example only. No warranty is expressed or implied.);
********** COMMENT();
********** COMMENT();
********** COMMENT(Receives: Service (#S_175SRV));
********** COMMENT( Page name (#S_175PAG));
********** COMMENT(=======================================================);
********** COMMENT(Function control options);
FUNCTION OPTIONS(*DIRECT *WEBEVENT);
********** COMMENT();
********** COMMENT(<RDML ONCONDITION> field.);
********** COMMENT(Group and field definitions);
********** COMMENT();
GROUP_BY NAME(#PANELDATA) FIELDS((#S_175FDES *HIDDEN)(#S_IFSPATH *HIDDEN)(#S_175SRV *HIDDEN));
GROUP_BY NAME(#S_GRPVVP) FIELDS((#S_175VSL)(#S_175VOY)(#S_175PRT)(#S_175DAT)(#S_175DATV));
DEF_LIST NAME(#S_LSTPORT) FIELDS((#S_175PRTW)(#S_175SEQ)(#S_175DAT1)(#S_175DAT2)(#S_175DAT3)(#S_175DAT4)) TYPE(*WORKING);
DEF_LIST NAME(#S_175VVP) FIELDS((#S_175PRTW)(#S_175DAT1)(#S_175DAT2)(#S_175DAT3)(#S_175DAT4));
********** COMMENT();
DEFINE FIELD(#S_175PRTW) REFFLD(#S_175PRT);
********** COMMENT();
DEFINE FIELD(#S_175VOYP) REFFLD(#S_175VOY);
DEFINE FIELD(#S_175VOY1) REFFLD(#S_175VOY);
DEFINE FIELD(#S_175VOY2) REFFLD(#S_175VOY);
DEFINE FIELD(#S_175VOY3) REFFLD(#S_175VOY);
DEFINE FIELD(#S_175VOY4) REFFLD(#S_175VOY);
********** COMMENT();
DEFINE FIELD(#S_175VSL1) REFFLD(#S_175VSL);
DEFINE FIELD(#S_175VSL2) REFFLD(#S_175VSL);
DEFINE FIELD(#S_175VSL3) REFFLD(#S_175VSL);
DEFINE FIELD(#S_175VSL4) REFFLD(#S_175VSL);
********** COMMENT();
DEFINE FIELD(#S_175DATC) TYPE(*CHAR) LENGTH(020) COLHDG('Arrive/' 'Depart/' DATE) INPUT_ATR(LC);
DEFINE FIELD(#S_175DAT1) REFFLD(#S_175DATC);
DEFINE FIELD(#S_175DAT2) REFFLD(#S_175DATC);
DEFINE FIELD(#S_175DAT3) REFFLD(#S_175DATC);
DEFINE FIELD(#S_175DAT4) REFFLD(#S_175DATC);
********** COMMENT();
DEF_ARRAY NAME(#SVO) INDEXES(#II) OF_FIELDS(#S_175VOY1 #S_175VOY2 #S_175VOY3 #S_175VOY4);
DEF_ARRAY NAME(#SVL) INDEXES(#II) OF_FIELDS(#S_175VSL1 #S_175VSL2 #S_175VSL3 #S_175VSL4);
DEF_ARRAY NAME(#SDT) INDEXES(#II) OF_FIELDS(#S_175DAT1 #S_175DAT2 #S_175DAT3 #S_175DAT4);
********** COMMENT();
********** COMMENT(Mainline);
********** COMMENT();
********** COMMENT();
USE BUILTIN(TCONCAT) WITH_ARGS(#S_IFSPATH '/') TO_GET(#S_IFSPATH);
CHANGE FIELD(#II) TO(0);
CHANGE FIELD(#S_175VOYP) TO(*NULL);
SELECT FIELDS(#S_GRPVVP) FROM_FILE(SETVVP) WITH_KEY(#S_175SRV);
********** COMMENT(voyage/vessel ports in Voyage Vessel order);
********** COMMENT(allocate an array index number for each voyage);
IF COND('#S_175VOYP *NE #S_175VOY');
IF COND('#II *GE 4');
********** COMMENT(no more room on page);
LEAVE;
ENDIF;
CHANGE FIELD(#II) TO('#II + 1');
CHANGE FIELD(#S_175VOYP) TO(#S_175VOY);
CHANGE FIELD(#SVO#II) TO(#S_175VOY);
CHANGE FIELD(#SVL#II) TO(#S_175VSL);
ENDIF;
********** COMMENT(get the list entry for this port);
LOC_ENTRY IN_LIST(#S_LSTPORT) WHERE('#S_175PRTW *EQ #S_175PRT');
********** COMMENT(convert numeric date to character);
SUBSTRING FIELD(#S_175DATV 1) INTO_FIELD(#S_175DATC 1);
USE BUILTIN(CONVERTDATE) WITH_ARGS(#S_175DATC A N) TO_GET(#S_175DATC);
CHANGE FIELD(#SDT#II) TO(#S_175DATC);
IF_STATUS IS_NOT(*OKAY);
CHANGE FIELD(#S_175PRTW) TO(#S_175PRT);
********** COMMENT(Get the port sequence in the voyage.);
********** COMMENT(will not have a record in the 'first port' file.);
CHANGE FIELD(#S_175SEQ) TO(*NULL);
FETCH FIELDS(#S_175SEQ) FROM_FILE(SETPT1) WITH_KEY(#S_175SRV #S_175PRT);
ADD_ENTRY TO_LIST(#S_LSTPORT);
ELSE;
UPD_ENTRY IN_LIST(#S_LSTPORT);
ENDIF;
ENDSELECT;
********** COMMENT();
********** COMMENT(Add list entries that will serve as column headings);
CLR_LIST NAMED(#S_175VVP);
********** COMMENT(Vessel);
CHANGE FIELD(#S_175PRTW) TO('''(Vessel)''');
BEGIN_LOOP USING(#II) TO(4);
CHANGE FIELD(#SDT#II) TO(#SVL#II);
END_LOOP;
ADD_ENTRY TO_LIST(#S_175VVP);
********** COMMENT(Voyage);
CHANGE FIELD(#S_175PRTW) TO('''(Voyage)''');
BEGIN_LOOP USING(#II) TO(4);
CHANGE FIELD(#SDT#II) TO(#SVO#II);
END_LOOP;
ADD_ENTRY TO_LIST(#S_175VVP);
********** COMMENT(Sort & map the working list of ports into the);
********** COMMENT(browselist);
SORT_LIST NAMED(#S_LSTPORT) BY_FIELDS((#S_175SEQ));
SELECTLIST NAMED(#S_LSTPORT);
ADD_ENTRY TO_LIST(#S_175VVP);
ENDSELECT;
********** COMMENT();
********** COMMENT();
REQUEST FIELDS(#PANELDATA) BROWSELIST(#S_175VVP) EXIT_KEY(*NO) MENU_KEY(*NO) PROMPT_KEY(*NO);
********** COMMENT(=======================================================);
********** COMMENT(Process ........: SET_175B);
********** COMMENT(Function .......: SET175G);
********** COMMENT(Created on .....: 18/05/00 at 14:43:32);
********** COMMENT(Description ....: Shipping - Generate Service Schedule);
********** COMMENT(Version.........: 1);
********** COMMENT();
********** COMMENT(Full Description: The purpose of this function is to);
********** COMMENT(dynamically display the schedule for a service);
********** COMMENT();
********** COMMENT(Disclaimer: The following material is supplied as an);
********** COMMENT(example only. No warranty is expressed or implied.);
********** COMMENT();
********** COMMENT();
********** COMMENT(Receives: Service (#S_175SRV));
********** COMMENT( Page name (#S_175PAG));
********** COMMENT(=======================================================);
********** COMMENT(Function control options);
FUNCTION OPTIONS(*DIRECT *WEBEVENT);
********** COMMENT();
********** COMMENT(<RDML ONCONDITION> field.);
********** COMMENT(Group and field definitions);
********** COMMENT();
GROUP_BY NAME(#PANELDATA) FIELDS((#S_175FDES *HIDDEN)(#S_IFSPATH *HIDDEN)(#S_175SRV *HIDDEN));
GROUP_BY NAME(#S_GRPVVP) FIELDS((#S_175VSL)(#S_175VOY)(#S_175PRT)(#S_175DAT)(#S_175DATV));
DEF_LIST NAME(#S_LSTPORT) FIELDS((#S_175PRTW)(#S_175SEQ)(#S_175DAT1)(#S_175DAT2)(#S_175DAT3)(#S_175DAT4)) TYPE(*WORKING);
DEF_LIST NAME(#S_175VVP) FIELDS((#S_175PRTW)(#S_175DAT1)(#S_175DAT2)(#S_175DAT3)(#S_175DAT4));
********** COMMENT();
DEFINE FIELD(#S_175PRTW) REFFLD(#S_175PRT);
********** COMMENT();
DEFINE FIELD(#S_175VOYP) REFFLD(#S_175VOY);
DEFINE FIELD(#S_175VOY1) REFFLD(#S_175VOY);
DEFINE FIELD(#S_175VOY2) REFFLD(#S_175VOY);
DEFINE FIELD(#S_175VOY3) REFFLD(#S_175VOY);
DEFINE FIELD(#S_175VOY4) REFFLD(#S_175VOY);
********** COMMENT();
DEFINE FIELD(#S_175VSL1) REFFLD(#S_175VSL);
DEFINE FIELD(#S_175VSL2) REFFLD(#S_175VSL);
DEFINE FIELD(#S_175VSL3) REFFLD(#S_175VSL);
DEFINE FIELD(#S_175VSL4) REFFLD(#S_175VSL);
********** COMMENT();
DEFINE FIELD(#S_175DATC) TYPE(*CHAR) LENGTH(020) COLHDG('Arrive/' 'Depart/' DATE) INPUT_ATR(LC);
DEFINE FIELD(#S_175DAT1) REFFLD(#S_175DATC);
DEFINE FIELD(#S_175DAT2) REFFLD(#S_175DATC);
DEFINE FIELD(#S_175DAT3) REFFLD(#S_175DATC);
DEFINE FIELD(#S_175DAT4) REFFLD(#S_175DATC);
********** COMMENT();
DEF_ARRAY NAME(#SVO) INDEXES(#II) OF_FIELDS(#S_175VOY1 #S_175VOY2 #S_175VOY3 #S_175VOY4);
DEF_ARRAY NAME(#SVL) INDEXES(#II) OF_FIELDS(#S_175VSL1 #S_175VSL2 #S_175VSL3 #S_175VSL4);
DEF_ARRAY NAME(#SDT) INDEXES(#II) OF_FIELDS(#S_175DAT1 #S_175DAT2 #S_175DAT3 #S_175DAT4);
********** COMMENT();
********** COMMENT(Mainline);
********** COMMENT();
********** COMMENT();
USE BUILTIN(TCONCAT) WITH_ARGS(#S_IFSPATH '/') TO_GET(#S_IFSPATH);
CHANGE FIELD(#II) TO(0);
CHANGE FIELD(#S_175VOYP) TO(*NULL);
SELECT FIELDS(#S_GRPVVP) FROM_FILE(SETVVP) WITH_KEY(#S_175SRV);
********** COMMENT(voyage/vessel ports in Voyage Vessel order);
********** COMMENT(allocate an array index number for each voyage);
IF COND('#S_175VOYP *NE #S_175VOY');
IF COND('#II *GE 4');
********** COMMENT(no more room on page);
LEAVE;
ENDIF;
CHANGE FIELD(#II) TO('#II + 1');
CHANGE FIELD(#S_175VOYP) TO(#S_175VOY);
CHANGE FIELD(#SVO#II) TO(#S_175VOY);
CHANGE FIELD(#SVL#II) TO(#S_175VSL);
ENDIF;
********** COMMENT(get the list entry for this port);
LOC_ENTRY IN_LIST(#S_LSTPORT) WHERE('#S_175PRTW *EQ #S_175PRT');
********** COMMENT(convert numeric date to character);
SUBSTRING FIELD(#S_175DATV 1) INTO_FIELD(#S_175DATC 1);
USE BUILTIN(CONVERTDATE) WITH_ARGS(#S_175DATC A N) TO_GET(#S_175DATC);
CHANGE FIELD(#SDT#II) TO(#S_175DATC);
IF_STATUS IS_NOT(*OKAY);
CHANGE FIELD(#S_175PRTW) TO(#S_175PRT);
********** COMMENT(Get the port sequence in the voyage.);
********** COMMENT(will not have a record in the 'first port' file.);
CHANGE FIELD(#S_175SEQ) TO(*NULL);
FETCH FIELDS(#S_175SEQ) FROM_FILE(SETPT1) WITH_KEY(#S_175SRV #S_175PRT);
ADD_ENTRY TO_LIST(#S_LSTPORT);
ELSE;
UPD_ENTRY IN_LIST(#S_LSTPORT);
ENDIF;
ENDSELECT;
********** COMMENT();
********** COMMENT(Add list entries that will serve as column headings);
CLR_LIST NAMED(#S_175VVP);
********** COMMENT(Vessel);
CHANGE FIELD(#S_175PRTW) TO('''(Vessel)''');
BEGIN_LOOP USING(#II) TO(4);
CHANGE FIELD(#SDT#II) TO(#SVL#II);
END_LOOP;
ADD_ENTRY TO_LIST(#S_175VVP);
********** COMMENT(Voyage);
CHANGE FIELD(#S_175PRTW) TO('''(Voyage)''');
BEGIN_LOOP USING(#II) TO(4);
CHANGE FIELD(#SDT#II) TO(#SVO#II);
END_LOOP;
ADD_ENTRY TO_LIST(#S_175VVP);
********** COMMENT(Sort & map the working list of ports into the);
********** COMMENT(browselist);
SORT_LIST NAMED(#S_LSTPORT) BY_FIELDS((#S_175SEQ));
SELECTLIST NAMED(#S_LSTPORT);
ADD_ENTRY TO_LIST(#S_175VVP);
ENDSELECT;
********** COMMENT();
********** COMMENT();
REQUEST FIELDS(#PANELDATA) BROWSELIST(#S_175VVP) EXIT_KEY(*NO) MENU_KEY(*NO) PROMPT_KEY(*NO);