Not sure anyone can reasonably help given that we don't have the entire program, or at least the code that executes the subroutine, and the display file DDS.
What is the result of executing the subroutine? Are the fields Flg_Error and WsMsg being set as expected?
If so, what logic in the mainline code is used to EXFMT the display file format? Upon return from the subroutine your mainline code would need to re-display the screen to show the message. Is that happening and the message just doesn't display?
I'm not confident I understand what you desire to happen versus what is actually happening.
As for the use of SELECT and ENDSL you should be able to read about those op-codes in the RPG Reference Manual. Pretty much operates like any other language.
Original Message:
Sent: Wed October 04, 2023 11:47 AM
From: Kevin Steve
Subject: Displaying a message
Hi,
To display that soft warning which needs to be overridden changes need to be done inside this VLDT1 subroutine.
Here in this Subroutine 'VLDT1 - To validate scanned LPNs'
How can we make below changes :-
when they enter Pallet and it does NOT exist in IDCASE10 then hard stop error.
-->If they enter case# (that does NOT start with letter 'L')
and it does NOT exist in IDCASE00 file, then hard stop error.
-->If they enter valid case# (ie., it exists in IDCASE00 but NOT in IDCASE10)
then "warning soft error". With the use of SELECT and ENDSL statements combining with LeaveSR ?
If any one has expertise in SQLRPGLE then could someone please advise here ?
Thanks
------------------------------
Kevin Steve
Original Message:
Sent: Tue October 03, 2023 04:50 AM
From: Kevin Steve
Subject: Displaying a message
Hi,
Anyone has any idea on this please ?
Thanks
------------------------------
Kevin Steve
Original Message:
Sent: Mon October 02, 2023 01:52 PM
From: Kevin Steve
Subject: Displaying a message
Hi,
Just for better clarity i changed my last code( 2nd post) after the below statements in this subroutine (post 1-Subroutine VLDT1 - To validate scanned LPNs ) which displays this warning message but we can't override it so i want it to be overridden and continue the flow of orginal subroutine later on after bypassing this soft warning message.
[code]
// Invalid case/Pallet scanned
Chain(N) WSCASN IDCASE00; //Single Case
IF Not %Found(IDCASE00);
Chain(N) (LdWhse:' ':WSCASN) IDCASE10;
If Not %Found(IDCASE10);
WsMsg = 'Not Valid Cs/Pl';
Flg_Error = 'Y' ;
LeaveSr;
[/code]
So Kindly advise the desired changes here.
Thanks
------------------------------
Kevin Steve
Original Message:
Sent: Mon October 02, 2023 01:31 PM
From: Kevin Steve
Subject: Displaying a message
Hi,
One of the subroutine in my program checks whether case/pallet entered is valid or not and accordingly it displays message on the screen.
Currently it accepts case id and displays it on the screen as per program's flow but i just want to add a message on the screen that when any case id is entered that 'you entered case not pallet' and after this it should proceed like earlier i mean after overriding this message program's flow should be continued like earlier so i just wanted to introduce this warning kind of message only which should be overriden(soft warning).
my subroutine to validate pallet and case id is like below , kindly advise suitable changes in this subroutine to get this soft warning introduced in it.
[code]
**************************************************************************
* Subroutine VLDT1 - To validate scanned LPNs *
**************************************************************************
C Vldt1 BegSr
*
/Free
Wrk_Paid = *Blanks;
ItemClas = *Blanks;
em01 FlgProcess2 = 'N';
If WSCASN = *Blanks;
WsMsg = 'Scan Palet/Case';
Flg_Error = 'Y' ;
LeaveSr;
EndIf;
// Invalid case/Pallet scanned
Chain(N) WSCASN IDCASE00; //Single Case
IF Not %Found(IDCASE00);
Chain(N) (LdWhse:' ':WSCASN) IDCASE10;
If Not %Found(IDCASE10);
WsMsg = 'Not Valid Cs/Pl';
Flg_Error = 'Y' ;
LeaveSr;
Else ;
if PltOrCase = ' ' ;
PltOrCase = 'P' ;
em22 elseif PltOrCase = 'X' and idpaid <> *blanks;
| exec sql
| select count(*) into :count from idcasez3
| where idwhse = :ldwhse and idzone = :w_zone and
| idaisl = :w_aisl and idbay = :w_bay and
| idlevl = :w_levl and idposn = :w_posn and
| idpaid = ' ';
| if count > *zero;
| WsMsg = 'Scan ONLY Cases';
| Flg_Error = 'Y' ;
| LeaveSr;
| else;
| Exec Sql
| Select count(*) into :count from idcase36
| where idpaid = :idpaid;
| if count = stptqt or count = stnum5;
| WsMsg = 'Partial Pallet Only';
| Flg_Error = 'Y' ;
| LeaveSr;
| endif;
em22 endif;
else;
if PltOrCase = 'C' ;
WsMsg = 'Scan ONLY Cases';
Flg_Error = 'Y' ;
LeaveSr;
endif;
endif;
EndIf;
ELSE;
If PltOrCase = ' ' ;
PltOrCase = 'C' ;
Else;
if PltOrCase = 'P' ;
WsMsg = 'Scan ONLY Pallet';
Flg_Error = 'Y' ;
LeaveSr;
endif;
EndIf;
EndIf;
em22 // If called from TOM Back Order, check GTOBKORP
| if l00_inpln <> *blanks;
| chain(n) (l00_inlocn:l00_inpln:wscasn) gtobkorp;
| if not %found (gtobkorp);
| wsmsg = 'Invalid Pallet/Case';
| Flg_Error = 'Y';
| LeaveSr;
| else;
| if boflag = '1';
| wsmsg = 'Invalid Pallet/Case';
| Flg_Error = 'Y';
| LeaveSr;
| endif;
| endif;
em22 endif;
//Case or cases on pallet can NOT be locked with 'QH' lock
Chain(N) WSCASN IDCASE00; //Single Case
IF %Found(IDCASE00);
ra02 //if IdLkcd = 'QH' OR IdLkc2 = 'QH' OR IdLkc3 = 'QH' OR
ra02 // IdLkc4 = 'QH' OR IdLkc5 = 'QH' ;
ra02 //Lock code logic
ra02 exSr @getLockCodes;
ra02 If lockCodeErr;
WsMsg = 'No Locked Cases';
Flg_Error = 'Y' ;
LeaveSr;
endif;
//can NOT have SDC & SD2 Items. They belong to SDC/SD2
em01 Exsr Read_BNK012P;
| //GSITEM = %trim(IdStyl) + %trim(IdSsfx);
| //Chain GSITEM GSDCXREFP;
| //If %found(GSDCXREFP);
| // if (IDCASN < GSLOW OR IDCASN > GSHIGH OR
| // IDSC1 = GSREVS);
| // WsMsg = 'No SDC/SD2 units';
| // Flg_Error = 'Y' ;
| // LeaveSr;
| // endif;
em01 //EndIf;
ELSE;
SetLL (LdWhse:' ':WSCASN) IDCASE10; //Pallet is scanned
ReadE(N) (LdWhse:' ':WSCASN) IDCASE10;
DoW Not %Eof(IDCASE10);
Wrk_Paid = 'Y' ;
//Case or cases on pallet can NOT be locked with 'QH' lock
ra02 //if IdLkcd = 'QH' OR IdLkc2 = 'QH' OR IdLkc3 = 'QH' OR
ra02 // IdLkc4 = 'QH' OR IdLkc5 = 'QH' ;
ra02 //Lock code logic
ra02 exSr @getLockCodes;
ra02 If lockCodeErr;
WsMsg = 'No Locked Cases';
Flg_Error = 'Y' ;
LeaveSr;
endif;
//can NOT have SDC & SD2 Items. They belong to SDC/SD2
em01 Exsr Read_BNK012P;
| //GSITEM = %trim(IdStyl) + %trim(IdSsfx);
| //Chain GSITEM GSDCXREFP;
| //If %found(GSDCXREFP);
| // if (IDCASN < GSLOW OR IDCASN > GSHIGH OR
| // IDSC1 = GSREVS);
| // WsMsg = 'No SDC/SD2 units';
| // Flg_Error = 'Y' ;
| // LeaveSr;
| // endif;
em01 //EndIf;
ReadE(N) (LdWhse:' ':WSCASN) IDCASE10;
EndDo;
ENDIF;
//save item first time when you scanned
IF W_Styl = *Blanks;
W_Whse = IdWhse;
W_Co = IdCo ;
W_Div = IdDiv ;
W_Zone = IdZone;
W_Aisl = IdAisl;
W_Bay = IdBay ;
W_Levl = IdLevl;
W_Posn = IdPosn;
W_Styl = IdStyl;
W_Ssfx = IdSsfx;
W_Item = %trim(W_Styl) + %trim(W_Ssfx);
ELSE;
//can NOT have mixed SKU
If W_Styl <> IdStyl OR W_Ssfx <> IdSsfx ;
WsMsg = 'No Mixed SKUs';
Flg_Error = 'Y' ;
LeaveSr;
EndIf;
ENDIF;
em04 // Make sure full and partial pallet not being mixed
| PartialPalt = 'N';
em05 // Check if equipment
|| itnbr = %trim(W_Styl) + %trim(W_Ssfx);
|| Chain ('003':itnbr) itmrevl1;
em05 If %found (itmrevl1) and opegrp = 'EQ';
| Chain ('GOODMAN':'MFG':' ':' ':W_Styl:W_Ssfx) STSTYL00;
| If PltOrCase = 'C';
| If stptqt > 1 or stnum5 > 1;
| PartialPalt = 'Y';
| EndIf;
| Else;
| If PltOrCase = 'P';
| Exec Sql
| Select count(*) into :count from idcase36
| where idpaid = :idpaid;
| If count <> stptqt and count <> stnum5;
| PartialPalt = 'Y';
| EndIf;
| Else;
| If PltOrCase = 'X';
em22 if idpaid = *blanks;
|| PartialPalt = 'N';
|| else;
|| PartialPalt = 'Y';
em22 endif;
| EndIf;
| EndIf;
| EndIf;
|
| // Loop thru cases in Printer location/Pallet#/Case#
| // to check if it contains partial pallets
| Setll (LdWhse:' ':W_FlLocn) IDCASE10;
| Reade (LdWhse:' ':W_FlLocn) IDCASE10;
| If %eof (IDCASE10);
| P_Zone = %Subst(W_FLLOCN:1:2);
| P_Aisl = %Subst(W_FLLOCN:3:2);
| P_Bay = %Subst(W_FLLOCN:5:2);
| P_Levl = %Subst(W_FLLOCN:7:2);
| P_Posn = %Subst(W_FLLOCN:9:2);
| Setll (LdWhse:P_Zone:P_Aisl:P_Bay:P_Levl:P_Posn) IDCASEZ3;
| Reade(n) (LdWhse:P_Zone:P_Aisl:P_Bay:P_Levl:P_Posn) IDCASEZ3;
| EndIf;
| If not %eof (IDCASE10) or not %eof (IDCASEZ3);
| If IdPaid = *blanks;
| // Carton
| If stptqt > 1 or stnum5 > 1;
| PltOrCase = 'X';
| EndIf;
| Else;
| // Pallet
| Exec Sql
| Select count(*) into :count from idcase36
| where idpaid = :idpaid;
| If count <> stptqt and count <> stnum5;
| PltOrCase = 'X';
| EndIf;
| EndIf;
|
| // Set error if partial pallet in printer location
| // and non-partial pallet is being loaded
| If PltOrCase = 'X' and PartialPalt <> 'Y';
| WsMsg = 'Partial Pallet Only';
| Flg_Error = 'Y' ;
| LeaveSr;
| Else;
| If PltOrCase = 'C' and PartialPalt = 'Y';
| WsMsg = 'Scan ONLY Cases';
| Flg_Error = 'Y' ;
| LeaveSr;
| Else;
| If PltOrCase = 'P' and PartialPalt = 'Y';
| WsMsg = 'Scan ONLY Full Palt';
| Flg_Error = 'Y' ;
| LeaveSr;
| EndIf;
| EndIf;
| EndIf;
|
| EndIf;
em04
em05 EndIf;
kc01
| stprgr = *blanks;
| Chain ('GOODMAN':'MFG':' ':' ':W_Styl:W_Ssfx) STSTYL00;
| if stprgr = *blanks;
| Flg_Error = 'Y' ;
| wssku = W_Styl + W_Ssfx;
| WsMsg = 'New item - See Sup';
| LeaveSr;
kc01 endif;
/End-Free
*
* No Error ? then move units from EOL locn into Forklift locn
* Move scanned Pallet(s)/Case(s) from EOL locn into Forklift printer locn
C Exsr MvEOL2Prt
*
/Free
Chain(N) ISZ3Key1 ISLOCNZ3;
if %Found(ISLOCNZ3);
WsSKU = %trim(IsStyl) + %trim(IsSsfx);
W_Item = %trim(IsStyl) + %trim(IsSsfx);
WsInvu = IsInvu;
//find Item Class
chain (W_Item:'DDC') ITEMBL;
if %found(ITEMBL);
ItemClas = I_ITCLS; //ISSYR exist both in ITEMBL & ISLOCN files
endif;
endif;
/End-Free
C EndSr
**************************************************************************
[/code]
------------------------------
Kevin Steve
------------------------------