|
|
All AS/400 Tip Categories
/
AS/400 Programming
/
Help - Windowed Subfiles
Question:
I am attempting to create a display that when opened is a subfile in a
window. That much in itself is working fine. My problem is that when this
program is called (currently from a command line, but eventually will be
assigned to the Attention key.) The entire contents of the screen is erased
before the initial window is displayed. I want the popup window to overlay
anything already on the screen.
In the DDS, I'm using the WINDOW, OVERLAY, and PROTECT keywords.
I wish I had the DDS in front of me to explain what I already have in place
better...
Can anyone assist me that has done this type of thing before?
Answer(s):
You may insert the following dummy record instead:
*
* DER DUMMY SATZ MUSS VORHANDEN SEIN,
* AUCH WENN KEIN ZUGRIFF AUF IHN ERFOLGT !!
*
*----------------------------------------------------*
RADD A R DUMMY ASSUME
RADD A 11 1' '
Try ASSUME for the keyword.
If I remember correctly, you need to define a dummy record format with certain
keywords. I'm not sure what they are but can get an example id you still need
help
One more thing if you intend to use your window program as an attention key
handler, you must specify RSTDSP(*YES) on each and every display file that your
attention key program may overlay, or as IBM is wont to say "unpredictable
results may occur." We changed the command default for CRTDSPF for this very
reason.
Remember too, that you must explicitly close your window display file or exit
your program with LR on. If you don't do this the background screens from the
first invocation of the program will be retained behind your window not matter
what is on the display when the program is subsequently called.
The easiest way is to add another format to the display file that is never
used but contains the ASSUME keyword. The reason that your screen is being
cleared is that when a display file is first used it always clears the
current screen. By using the ASSUME keyword you are telling the program
that the display file has already been opened.
I hope this answers your question
To accomplish what you are asking is relatively easy: create DDS record format
DUMMY and specifiy the ASSUME keyword. You do not need to reference this format
in your program. It's mere presence in the display file will prevent the
screen from being cleared.
Another thing: if this program is being called by other programs, make sure you
do an explicit open/close of the display file, or exit with LR on
All you have to do is create a new record format:
R DUMMY
ASSUME
23 1 ' '
and the existing panel will not be erased. This is a must for
all windows. Strange is it not?
I have an example, below, I can share that is using a windowed-
subfile. Strip-out the DDS, and create a *DSPF, and strip-out the
RPGIV code, and create a *RPGLE. Remember to compile the
*DSPF with RSTDSP(*YES). Let me know what you think?
--------------------------------------------------------------------------
-------
The DDS Code...
A DSPSIZ(24 80 *DS3
-
A 27 132 *DS4)
A PRINT
A R SUBF01 SFL
A #FLDNAM 10A O 3 1
A #FLDTYP 1A O 3 14
A #DIGITS 4Y 0O 3 37EDTCDE(Z)
A #DECIMALS 2S 0O 3 45
A #STRPOS 5Y 0O 3 25EDTCDE(Z)
A R CNTR01 SFLCTL(SUBF01)
A *DS3 SFLSIZ(0016)
A *DS4 SFLSIZ(0016)
A *DS3 SFLPAG(0015)
A *DS4 SFLPAG(0015)
A *DS3 WINDOW(SCRN01)
A *DS4 WINDOW(SCRN01)
A N75 ROLLUP(25)
A CA03(03 'exit')
A KEEP
A BLINK
A CSRLOC(SETROW SETCOL)
A OVERLAY
A SFLCSRRRN(&GETRRN)
A 50 51 SFLDSP
A 50 SFLDSPCTL
A 52 SFLCLR
A 75 SFLEND
A @PAGE 4S 0H SFLRCDNBR
A SETROW 3S 0H
A SETCOL 3S 0H
A GETRRN 5S 0H
A 1 1'Record Format Layout...'
A DSPATR(HI)
A SCRFLDDBFL 10A O 1 38DSPATR(HI)
A DSPATR(UL)
A SCRFLDDBLB 10A O 1 25DSPATR(HI)
A DSPATR(UL)
A 1 36'/'
A DSPATR(HI)
A 1 49'('
A DSPATR(HI)
A SCRFLDDBRF 10A O 1 51DSPATR(HI)
A DSPATR(UL)
A 1 62')'
A DSPATR(HI)
A 2 1' Field '
A DSPATR(UL)
A COLOR(PNK)
A 2 12'Type'
A DSPATR(UL)
A COLOR(PNK)
A 2 17'Starting Position'
A DSPATR(UL)
A COLOR(PNK)
A 2 35'Length'
A DSPATR(UL)
A COLOR(PNK)
A 2 42'Decimals'
A DSPATR(UL)
A COLOR(PNK)
A R SCRN01
A *DS3 WINDOW(2 2 21 72)
A *DS4 WINDOW(2 2 21 72)
A OVERLAY
A WDWBORDER((*COLOR BLU) (*DSPATR RI)-
A (*CHAR ' '))
A USRRSTDSP
A 18 1'
-
A
-
A '
A DSPATR(UL)
A DSPATR(HI)
A 19 1'To select a field, position your
c-
A ursor and press ENTER...
-
A '
A COLOR(PNK)
A 20 1'F3-Exit
-
A
-
A '
A DSPATR(HI)
A R ASSUME ASSUME
A 24 79' '
------------------------------------------------------------------------
The RPGIV Code...
*
**********************************************
* This application allows the user to display the
* Record Format Layout of a File(Passed Parm),
* and Returns the FIELD-NAME, and LENGTH...
*
* ...sgroi
**********************************************
*
/EJECT
*
FRCDL600D CF E WORKSTN
F SFILE(SUBF01:@RRN)
F INFDS(@LOCATE)
*
D@LOCATE DS
D@CURSOR 388 389B 0
D@FIRST 378 379B 0
*
D RETURNNAME S 10A
D RETURNLEN S 2A
D @RRN S 4S 0 INZ(*ZEROS)
D @REBLD S 1A INZ(*OFF)
D @BAD S 1A INZ(*OFF)
D @DONE S 1A INZ(*OFF)
D @ERR S 1A INZ(*OFF)
D @SKIP S 1A INZ(*OFF)
D @MODE S 1A INZ(*BLANKS)
D MESSAGEQUE S 10A INZ('*')
D MSGDTALEN S 8B 0 INZ(60)
D MSGQUENBR S 8B 0 INZ(0)
D MESSAGEKEY S 4A
D MESSAGEFIL S 20A
D MESSAGETYP S 10A INZ('*DIAG')
D @RRN# S LIKE(@RRN) INZ(*ZEROS)
D @PASS S LIKE(@RRN) INZ(*ZEROS)
*
D X S 4S 0 INZ(*ZEROS)
D @FIELDS S 4S 0 INZ(*ZEROS)
D F S 4S 0 INZ(*ZEROS)
*
D @FLDNAM S 10A DIM(150) INZ(*BLANKS)
D @FLDTYP S 1A DIM(150) INZ(*BLANKS)
D @FLDLST S 14S 0 DIM(150) INZ(*ZEROS)
*
D ErrorDs DS INZ
D BytesProvd 1 4B 0
D BytesAvail 5 8B 0
D MessageId 9 15
D Reserved 16 16
D MessageDta 17 116 INZ(*BLANKS)
*
D GENDS DS
D OffsetHdr 117 120B 0
D SizeHdr 121 124B 0
D OffsetLst 125 128B 0
D NbrInLst 133 136B 0
D SizeEntry 137 140B 0
*
D Input DS
D UserSpace 1 20
D SpaceName 1 10
D SpaceLib 11 20
D InpFFilLib 29 48
D InpFilNme 29 38
D InpFilLib 39 48
D InpRcdFmt 49 58
*
D HeaderDS DS
D OutFilNme 1 10
D OutLibNme 11 20
D OutType 21 25
D OutFormat 31 40
D RecordLen 41 44B 0
*
D LISTDS DS
D SfFld 1 10
D SfType 11 11
D BufferOut 13 16B 0
D FieldLen 21 24B 0
D Digits 25 28B 0
D Decimals 29 32B 0
D FieldDesc 33 82
*
D DS
D StartPos 1 4B 0
D StartLen 5 8B 0
D SpaceLen 9 12B 0
*
D DS
D @FLDLST1 1 14S 0
D @STRPOS 1 4S 0
D @FLDLEN 5 8S 0
D @DIGITS 9 12S 0
D @DECIMALS 13 14S 0
*
/EJECT
*
***********************************************
*MAINLINE...
***********************************************
*
C EVAL *INLR = *ON
*
C EXSR $GETDBFLDS
*
C EXSR $POSITION
C EXSR $PROCESS
*
C EXSR $SHUT_DOWN
*
/EJECT
*
************************************************
C $POSITION BEGSR
* POSITION SUBFILE RECORDS...
************************************************
*
C Z-ADD 1 @PAGE
*
C CLEAR @RRN
*
C Z-ADD X @FIELDS
*
C EVAL *IN50 = *OFF
C EVAL *IN51 = *OFF
C EVAL *IN52 = *ON
*
* CLEAR SUBFILE...
*
C WRITE CNTR01
*
C ENDSR
*
/EJECT
*
*********************************************
C $PROCESS BEGSR
* PROCESS SUBFILE, AND USER FUNCTIONS...
*********************************************
*
* F3-EXIT...
*
C DOU *IN03=*ON
*
C EXSR $FILLSFL
*
C IF @RRN > *ZEROS
C EVAL *IN50 = *ON
C EVAL *IN51 = *ON
C EVAL *IN52 = *OFF
C ELSE
C EVAL *IN50 = *ON
C EVAL *IN51 = *OFF
C EVAL *IN52 = *OFF
C ENDIF
*
C EVAL @RRN# = @RRN
*
C DOU *IN03=*ON OR *IN25=*ON
*
C WRITE SCRN01
C EXFMT CNTR01
*
C EVAL @REBLD = *OFF
*
C IF *IN03=*ON
C LEAVE
C ENDIF
*
C SELECT
*
* ROLLUP KEY PRESSED...
*
C WHEN *IN25 = *ON
C EVAL @RRN = @RRN#
C EVAL @PAGE = (@PAGE +15)
C CLEAR @PASS
*
* ENTER-PRESSED...
*
C OTHER
*
C EXSR $CURSOR
*
C ENDSL
*
* REPOSITION/REBUILD SUBFILE WHEN THIS FIELD * IS ON...
*
C IF @REBLD = *ON
C EXSR $POSITION
C LEAVE
C ENDIF
*
C ENDDO
C ENDDO
*
C ENDSR
*
/EJECT
*
***********************************************
C $CURSOR BEGSR
* CURSOR POSITIONING...
***********************************************
*
C EVAL @PAGE = @FIRST
*
C @CURSOR DIV 256 SETROW
C MVR SETCOL
*
C IF GETRRN > *ZEROS
C GETRRN CHAIN SUBF01 99
C IF *IN99 = *OFF
C MOVE #FLDNAM RETURNNAME
C MOVE #DIGITS RETURNLEN
C EXSR $SHUT_DOWN
C EVAL *INLR = *ON
C RETURN
C ENDIF
C ENDIF
*
C ENDSR
*
/EJECT
*
*********************************************
C $FILLSFL BEGSR
* FILL SUBFILE...
*********************************************
*
C EVAL *IN75 = *OFF
C CLEAR F
*
C 1 DO @FIELDS F
*
C CLEAR @FLDLST1
C MOVEA @FLDNAM(F) #FLDNAM
C MOVEA @FLDTYP(F) #FLDTYP
C MOVEA @FLDLST(F) @FLDLST1
C Z-ADD @STRPOS #STRPOS
C Z-ADD @DIGITS #DIGITS
C Z-ADD @DECIMALS #DECIMALS
*
C ADD 1 @RRN
C ADD 1 @PASS
*
C WRITE SUBF01
C CLEAR #FLDNAM
C CLEAR #FLDTYP
C CLEAR #STRPOS
C CLEAR #DIGITS
C CLEAR #DECIMALS
*
C IF F = @FIELDS
C EVAL *IN75 = *ON
C ENDIF
*
C ENDDO
*
C ENDSR
*
/EJECT
*
******************************************
C $GETDBFLDS BEGSR
******************************************
*
* This is neat!!!
* We're using the "QUSFLD" *API to get
* the RECORD-FORMAT-LAYOUT for the FILE
* that's defined for this app...
* -------------------------------------------------------
*
* First, we're gonna create a USER-SPACE in QTEMP
* to store all of the stuff we need...
*
* Now, we can create it...
*
C EVAL SpaceName = 'DSUSFD00'
C EVAL SpaceLib = 'QTEMP'
C MOVE SCRFLDDBFL InpFilNme
C MOVE SCRFLDDBLB InpFilLib
C EVAL BytesProvd = 116
C CALL 'QUSCRTUS'
C PARM UserSpace
C PARM *BLANKS SpaceAttr 10
C PARM 4096 SpaceLen
C PARM *BLANKS SpaceVal 1
C PARM '*ALL' SpaceAuth 10
C PARM *BLANKS SpaceText 50
C PARM '*YES' SpaceRepl 10
C PARM ErrorDs
*
C IF BYTESAVAIL <> 0
C EXSR $APIERRORS
C ENDIF
*
* Get the LIST FIELDs data for the FILE name passed...
*
C CALL 'QUSLFLD'
C PARM UserSpace
C PARM 'FLDL0100' ListFormat 8
C PARM InpFFilLib
C PARM SCRFLDDBRF InpRcdFmt
C PARM '1' OverRide 1
*
* Now, pull it in from the USER SPACE, with
* a RETRIEVE command...
* ------------------------------------------
* Have to do this a couple of times, since,
* everything we need is sittin' in different
* parts of the USER-SPACE...
* ------------------------------------------
* First, let's grab the GENERAL HEADER info from the *SPACE,
* and plop-it into the GENDS structure...
*
C EVAL StartPos = 1
C EVAL StartLen = 140
C CALL 'QUSRTVUS'
C PARM UserSpace
C PARM StartPos
C PARM StartLen
C PARM GenDs
*
* Then, grab some more, and put it into the HEADER *
structure...
*
C EVAL StartPos = OffsetHdr + 1
C EVAL StartLen = SizeHdr
C CALL 'QUSRTVUS'
C PARM UserSpace
C PARM StartPos
C PARM StartLen
C PARM HeaderDs
*
C EVAL SpaceName = 'DSUSFD00'
C EVAL SpaceLib = 'QTEMP'
*
C EVAL StartPos = OffsetLst + 1
C EVAL StartLen = SizeEntry
*
C CLEAR X
C CLEAR @FLDTYP
C CLEAR @FLDNAM
C CLEAR @FLDLST
*
* Now that we have some general information about the
* fields in the file, we can LOOP thru the next
* RETRIEVE, based on the number-of-fields counter,
* and grab what we need...
*
C DO NbrInLst
*
* Pull field-info and plop-it into the LIST structure...
*
C CALL 'QUSRTVUS'
C PARM UserSpace
C PARM StartPos
C PARM StartLen
C PARM ListDs
*
* We're gonna dump these values into arrays, because,
* we don't want too much I/O processing on FILES...
*
C EVAL X = (X + 1)
C MOVE SFFLD @FLDNAM(X)
C MOVE SFTYPE @FLDTYP(X)
C CLEAR @FLDLST1
C MOVE BUFFerout @STRPOS
C MOVE FIELDLEN @FLDLEN
C MOVE DIGITS @DIGITS
C MOVE DECIMALS @DECIMALS
C IF @DIGITS = *ZEROS
C MOVE FIELDLEN @DIGITS
C ENDIF
C MOVE @FLDLST1 @FLDLST(X)
*
C EVAL StartPos = StartPos + SizeEntry
C ENDDO
*
C ENDSR
*
/EJECT
*
**********************************************
C $SHUT_DOWN BEGSR
**********************************************
*
C EVAL SpaceName = 'DSUSFD00'
C EVAL SpaceLib = 'QTEMP'
C EVAL BytesProvd = 116
C CALL 'QUSDLTUS'
C PARM UserSpace
C PARM ErrorDs
*
C IF BYTESAVAIL <> 0
C EXSR $APIERRORS
C ENDIF
*
*
C ENDSR
*
/EJECT
*
*********************************************
C $APIERRORS BEGSR
**********************************************
*
* Standard API ERROR MESSAGE handling...
*
* ---------------------------------------------------------
*
C EVAL MESSAGEDTA = (MESSAGEDTA +
MESSAGEID)
C EVAL MESSAGEFIL = ('QCPFMSG ' +
'QSYS')
C EVAL MESSAGEID = 'CPF9898'
*
C CALL 'QMHSNDPM' PQHSNDPM
*
C ENDSR
*
/EJECT
*
****************************************
C *INZSR BEGSR
****************************************
*
C *ENTRY PLIST
C PARM SCRFLDDBFL
C PARM SCRFLDDBLB
C PARM SCRFLDDBRF
C PARM RETURNNAME
C PARM RETURNLEN
*
C PQHSNDPM PLIST
C PARM MESSAGEID
C PARM MESSAGEFIL
C PARM MESSAGEDTA
C PARM MSGDTALEN
C PARM MESSAGETYP
C PARM MESSAGEQUE
C PARM MSGQUENBR
C PARM MESSAGEKEY
C PARM ERRORDS
*
*
C ENDSR
*
/EJECT
*
Sorry, but memory can play tricks on you.
A "dummy" format is defined in the display file with the ASSUME
keyword. One field is defined in this format with the PUTOVR
attribute. This works!
If memory serves me correctly, you need to specify OVRDTA or OVRATR on all
fields.
Other tips in this category:
Click here to see all categories.
Socket Programming And Timeout Issues
Deleting Duplicate Records From A Table
What are data queues and how to use
Retrieving SMTP Name
RPGLE example for Dynamic Screen Manager API
Calling APIs from CL - with examples!
Compare two strings in RPG character by character
How to search all pgms in QCLSRC for a keyword
Retrieve Database File Description (QDBRTVFD) API
How to redirect the output to STDERR from RPG-IV
Using Multiformat Logical To Join 2 Identical File
D-Spec *LIKE DEFN
RPG: Converting Character to Decimal
Example of ILE RPG CGI Program
Handling ILE RPG Numeric Overflow
Help with Subfile Programming in RPG III
Zoned parameter in ILE RPG
What's the best way to do modulus in CL?
RPG Nesting Source Print Utility
More on changing the SIGNON screen
A silly ILE RPG question
Calling Validation List API From ILE RPG
Soft Coding Module Names
RPG Multidimensional Arrays in Action
Build a Page-Equals-Size Lookup Window
Procedures within an ILE RPG program
Break msg from RPG
Source Debugger for batch jobs
RPGLE debugging
Timing out display sessions in DDS
Building Dynamic Stored Procedures
Put Message in System Log
Dynamic RPGSQL
Randomize function for the AS/400
What's the fastest way to do a simple RPG lookup?
First time Data queue application in RPG
Print file overflow in ILE RPG
Mapping Fields To Arrays in ILE RPG
Named inidicators
STRQMQRY: comparision operator '=' isn't correct?!
DSPDTAARA to an outfile - possible?
PCL ESC codes in RPG
Sharing DB files between two AS/400s
Help: AS/400 subfiles
How do you change the signon screen?
Determining Even/Odd Values in queries
Get day of the week in RPG
Convert UPPERCASE to lowercase
RPG IV help using APIs
Help with data area API
Detecing IFS Files from RPG
SQL in a CL program
Calling AS/400 APIs from ILE RPG
CVTDAT command to convert an *MDY to a *LONGJUL
CPYSPLF Automation
Subfile Window background problem
Using IFS APIs w/ ILE RPG
Packed or unpacked fields?
QRYDFN to source and back
What does the "optimize" parm do?
Determining the calling program
Sockets in RPG?
Sorting a user space
OVRDBF and SECURE() keyword in an ILE environment
RPG record locking
RPG Differences: V2R3 to V3R2 upgrade
Getting the relative record number (RRN)
What is the longest parameter usable in RPG?
A C function that returns a string to an RPG pgm
Problems with ZADD *ZEROS
Can you highlight code in SEU?
Reusing deleted records - OK?
Is there an easy way to change edit codes?
Help - Windowed Subfiles
Logical Files and DDS
AS/400 'machine language' - MI Programming
Library lists and performance
How to use ERRSFL
Updating in CL
Record lock wait time
Message subfile problem
Physical File Joins
CL: Copying User Profiles
Commands and PARM
ILE RPG, RPG IV, vs. RPG/400
RPG and subfiles
Multiple subfiles
Field masking for passwords
SFLMODE keyword in an ILE program
Subfile size
Color coding records in a subfile
MSGLINE in windows
Controlling cursor movement on a display file
API returns error! Why?
Put an RPG Program on the Web
Variable length records in RPG
Differences Between RPG400, RPG IV, and ILE RPG
|