Ghost screen
Herald Kaffka
Herald.Kaffka at westfraser.com
Thu Oct 13 15:50:59 CDT 2016
You stole my next example.
Code fragment in a calling screen, user has just enter a rail car ID, in our business it is unlikely, but
Possible for a rail car to be recycled within 30 days. Check the rail car # the user has just input against the
Order file, warn (but do not error off) if the rail car has been recently used.
This one is referencing a table that is now in Oracle, (In Database MDS), but change that one file
Statement and it would (and has) worked find against RMS/ISAM files.
Note that the file is still a designer, and the only proc in this one is the initialize procedure.
In Calling Screen
===============================================================================================================
IF RAIL_CAR_ID > ' '
THEN RUN SCREEN MDS_LOCATION:MDS04072A.QKC &
PASSING T-BU, T-MILL-ID, T-RAIL-CAR, &
T-RAIL-DUP, T-DAY-30, T-ORD-ID MODE F
IF T-RAIL-DUP = 'Y'
THEN WARN = &
"*W* Duplicate RAIL CAR ID used within the past 30 days..."
==============================================================================================================
Ghost screen running a relatively complex edit
SET VERIFY ERROR
;============================================================================|
;/T/ - Ghost screen to check for duplicate RAIL CAR numbers
;============================================================================|
SCREEN name &
ACTIVITIES FIND, CHANGE &
RECEIVING &
T-BU, &
T-MILL-ID, &
T-RAIL-CAR, &
T-DUP-RAIL, &
T-DAY-30, &
T-ORD-ID
; ----------------------------------- TEMPS --------------------------------|
TEMP T-BU CHAR*2
TEMP T-MILL-ID CHAR*2
TEMP T-RAIL-CAR CHAR*10
TEMP T-DUP-RAIL CHAR*1
TEMP T-DAY-30 DATE
TEMP T-ORD-ID CHAR*7
TEMP T-COUNT NUM*4
FILE ORDER_HEADER IN MDS ALIAS OH DESIGNER OPEN CLOSE
ACCESS VIA BUSINESS_UNIT, MILL_ID, RAIL_CAR_ID & ;HGK
USING T-BU, T-MILL-ID, T-RAIL-CAR ;HGK
SELECT IF ORDER_ID OF OH <> T-ORD-ID AND &
(MODE_OF_SHIPMENT OF OH = 'CL' OR & ;HGK
MODE_OF_SHIPMENT OF OH = 'CB') ;HGK
;-------------------------------- PROCEDURES ------------------------------|
PROCEDURE INITIALIZE
BEGIN
LET T-COUNT = 0
LET T-DUP-RAIL = ""
WHILE RETRIEVING OH
BEGIN
IF DATE_STAMP GE T-DAY-30
THEN LET T-COUNT = T-COUNT + 1
END
IF T-COUNT GE 1
THEN LET T-DUP-RAIL = 'Y'
RETURN
END
;================================ < BUILD > ================================
BUILD
From: powerh-l-bounces+herald.kaffka=westfraser.com at lists.sowder.com [mailto:powerh-l-bounces+herald.kaffka=westfraser.com at lists.sowder.com] On Behalf Of Pickering, John (NORBORD)
Sent: Thursday, October 13, 2016 3:42 PM
To: tadjodha at stlucianic.org; powerh-l at lists.sowder.com
Subject: Re: Ghost screen
You could do this by passing in the stuff you need to edit and a flag to indicate the result of the edit. The main screen would set the stuff to be edited, call the ghost screen. The ghost screen would do the edits and set the status flag and then exit. The calling screen would then take whatever action is appropriate based on the value of the status flag.
Sent from my Bell Samsung device over Canada's largest network.
-------- Original message --------
From: tadjodha at stlucianic.org<mailto:tadjodha at stlucianic.org>
Date: 2016-10-13 3:30 PM (GMT-06:00)
To: powerh-l at lists.sowder.com<mailto:powerh-l at lists.sowder.com>
Subject: Re: Ghost screen
Hi Thanks for the info. However if I want to do lookups on files so as to alert the user by Hiliting/Flashing/Blinking a message on the Main screen , would this help.
Thanks
----- Original Message -----
From: "Herald Kaffka" <Herald.Kaffka at westfraser.com<mailto:Herald.Kaffka at westfraser.com>>
To: tadjodha at stlucianic.org<mailto:tadjodha at stlucianic.org>, powerh-l at lists.sowder.com<mailto:powerh-l at lists.sowder.com>
Sent: Thursday, 13 October, 2016 4:04:31 PM
Subject: RE: Ghost screen
Here's an example, (This one is keeping accounting happy by preventing various control #'s from duplicating rather than due to a file limit, but the concepts are the same).
Declare the screen as normal. List/define/type any passed in variables.
po/order#'s fall out by mill-id (t-pass-mill-id), do I want a Po or order # (t-x2), return the next # to the caller in t-number (Variable Names aren't mine, working example someone did a long time ago).
Declare local files. Note that the only file in this one is a designer, (no find/change/browse processing in this screen, just do something the background and exit).
Some internal procedures that do the actual "work".
An initialize procedure which in this case is examining the input variables and calling the correct internal procedure.
If your processing is small, just chunk all the processing in the initialize procedure. (The initialize procedure is a good place to drive small ghosts).
Better to have several small, tightly focused ghosts than a big "general purpose" one that's trying to do a bunch of unrelated
Tasks while trying to hide/autocomplete in the background.
All the explicit lock/get/put processing is in here as this one is not doing find/preupdate/update/postupdate type flow,
Just initialize, do it, and get out.
If you have no need to pass information back to the caller, a simple 1 line qtp call can also work in place of a ghost screen.
SCREEN name RECEIVING T-PASS-MILL-ID, T-X2, T-NUMBER
TEMP T-PASS-MILL-ID CHAR*2
TEMP T-X2 CHAR*2
TEMP T-NUMBER ZONED*5
FILE LAST_NUMBER_CONTROL DESIGNER
ACCESS VIA MILL_ID USING T-PASS-MILL-ID
PROCEDURE INTERNAL GET-NEXT-ORDER
BEGIN
LET T-NUMBER = 0
WHILE T-NUMBER = 0
BEGIN
LOCK LAST_NUMBER_CONTROL RECORD
GET LAST_NUMBER_CONTROL OPT
IF ACCESSOK
THEN BEGIN
LET T-NUMBER = LAST_ORDER_NUMBER OF LAST_NUMBER_CONTROL + 1
IF T-NUMBER = 99999
THEN LET LAST_ORDER_NUMBER OF LAST_NUMBER_CONTROL = 0
ELSE LET LAST_ORDER_NUMBER OF LAST_NUMBER_CONTROL = T-NUMBER
PUT LAST_NUMBER_CONTROL
END
UNLOCK LAST_NUMBER_CONTROL
END
END
PROCEDURE INTERNAL GET-NEXT-PO
BEGIN
LET T-NUMBER = 0
WHILE T-NUMBER = 0
BEGIN
LOCK LAST_NUMBER_CONTROL RECORD
GET LAST_NUMBER_CONTROL OPT
IF ACCESSOK
THEN BEGIN
LET T-NUMBER = LAST_PO_NUMBER OF LAST_NUMBER_CONTROL + 1
IF T-NUMBER = 99999
THEN LET LAST_PO_NUMBER OF LAST_NUMBER_CONTROL = 0
ELSE LET LAST_PO_NUMBER OF LAST_NUMBER_CONTROL = T-NUMBER
PUT LAST_NUMBER_CONTROL
END
UNLOCK LAST_NUMBER_CONTROL
END
END
PROCEDURE INITIALIZE
BEGIN
IF T-X2 = "OR"
THEN DO INTERNAL GET-NEXT-ORDER
IF T-X2 = "PO"
THEN DO INTERNAL GET-NEXT-PO
RETURN
END
BUILD
From: powerh-l-bounces+herald.kaffka=westfraser.com at lists.sowder.com<mailto:powerh-l-bounces+herald.kaffka=westfraser.com at lists.sowder.com> [mailto:powerh-l-bounces+herald.kaffka=westfraser.com at lists.sowder.com] On Behalf Of tadjodha at stlucianic.org<mailto:tadjodha at stlucianic.org>
Sent: Thursday, October 13, 2016 2:26 PM
To: powerh-l at lists.sowder.com<mailto:powerh-l at lists.sowder.com>
Subject: Ghost screen
Does any one have examples of a Ghost screen as the 31 file limit has been reached. OpenVMS 8.3 PH 8.40G Index file system?
Thanks
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
DISCLAIMER: This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information.Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system.Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful. (Please note that it is your responsibility to scan this message for v iruses).
-------------EOP---------------
This e-mail message and any attachments are confidential. Any dissemination or use of this information by a person other than the intended recipient is unauthorized. If you are not the intended recipient, please notify me by return e-mail, do not open any attachment and delete this communication and any copy.
Thank you
--
= = = = = = = = = = = = = = = = = = = = = = = = = = = =
Mailing list: powerh-l at lists.sowder.com<mailto:powerh-l at lists.sowder.com>
Subscribe: 'subscribe' in message body to powerh-l-request at lists.sowder.com<mailto:powerh-l-request at lists.sowder.com>
Unsubscribe: 'unsubscribe <password>' in message body to powerh-l-request at lists.sowder.com<mailto:powerh-l-request at lists.sowder.com>
http://lists.sowder.com/mailman/listinfo/powerh-l
This list is closed, thus to post to the list you must be a subscriber.
Add 'site:lists.sowder.com powerh-l' to your search terms to search the list archive at Google.
-------------EOP---------------
This e-mail message and any attachments are confidential. Any dissemination or use of this information by a person other than the intended recipient is unauthorized. If you are not the intended recipient, please notify me by return e-mail, do not open any attachment and delete this communication and any copy.
Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sowder.com/pipermail/powerh-l/attachments/20161013/4b0db555/attachment-0001.htm>
More information about the powerh-l
mailing list