• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1057
  • Last Modified:

Display file Overlay problem

Hi, I have come across a problem with display file overlays which is driving me potty. I'm sure the answer is fairly simple but at the moment its got me confused. I will demonstrate the problem with a simple example:

TEST1  DDS

A                                      CLEAR(15)                  
A                                      VLDCMDKEY(15 'Any Valid Com
A                                      PRINT(QSYSPRT   )          
A                                      DSPSIZ(*DS3)                
A          R RFMT1                                                
A                                      OVERLAY                    
A                               O  2  1'THIS IS FORMAT 1'                  
A*--------------------------------------------------------------  
A          R RFMT2                                                
A                                      OVERLAY                    
A                               O  3  2'THIS IS FORMAT 2'                  

TEST1 RPG

C                     WRITERFMT1                                  
C                     EXFMTRFMT2                                  
C                     SETON                     LR                


When I run this simple program I get the following results as expected:
>
THIS IS FORMAT 1    
 THIS IS FORMAT 2


HOWEVER if I change the display file so that the Text field "THIS IS FORMAT 2" begins in position 1 of line 3 rather than position 2 then the overlay does not work and when I run the program the result is as follows:

>                 
                 
THIS IS FORMAT 2  

Format 1 is cleared prior to displaying format 2.


Question

Why does changing the starting position from 2 to 1 have this effect. ? I am writing a bar-coding application and every position on the 22 character screen is like gold dust. I cannot affort to drop a character. Equally I need to display 2 seperate formats and cannot combine them into 1 single format.  I have compiled the screen as   RSTDSP(*YES) DFRWRT( *NO). I have also played around with keywords such as KEEP and ASSUME without much luck.

Appreciate any answers on this one.

regards

Pat Clarke
   
0
pclarkeirl
Asked:
pclarkeirl
  • 5
  • 2
  • 2
2 Solutions
 
ShadowProgrammerCommented:
Pat,

Any variable/text displayed on a screen uses the previous character to control the format attributes eg. highlighted, reverse image etc.
When you position the variable/text on character 1 of line 3, the attribute character becomes the last character on the previous line which then overlays that line (in your case line 2).

It is a pain but can't be avoided, just like you must always have a one character gap between fields.. which is the attribute character of the second variable/text.

Tony.
0
 
ShadowProgrammerCommented:
PS.  you could try creating windows... but they need a border so waste characters anyway.

So in your case of overlaying two lines you need to keep the 1st character of the 2nd line free for the attribute character of the first variable/text on that line.

Tony.
0
 
pclarkeirlAuthor Commented:
Hi Tony,
thanks for the comments. I am actually converting the display from a Window format to a standard display file format. I have been using windows to simulate the borders of the scanner which is 22 characters by 17 lines. As you said with Windows there was no problem with the Overlay but the 1st characters was taken up by the window border. I am now trying to move this display live to actual scanners and therefore there is no requirement for the Window. However to loose 1 character out of 22 is a major problem.

Is there any way around this other than having just one format in the display file. I have over 300 formats in the display file,  2 of these are displayed on every screen (Same as FORMAT 2) along with one of the remaining formats (FORMAT 1). To convert to a single format would be a nightmare.

regards

Pat    
0
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 
ShadowProgrammerCommented:
Pat,

I think you will have a problem with 1 format as well because no matter which way you do it you will still lose 1 character for each field/text on the screen.

The only workaround I could see is by making your display file a single format with 1 huge character variable of 371 or 372 characters.

If you have 22 characters by 17 lines = 374 characters but you will have to reduce this by 1 (maybe 2 characters) as you can't use the 1 character on the first line and I think you then have to take into account the attribute character !!.

Define a data structure to maybe split each line in their 22 characters, remembering that first line is only 21 (or 20 characters),
in you program build up each line as you want and then display the one field on the screen.

eg. for example, say we have a 5 line by 7 characters screen (& assume lose first two characters on line1)...

Populate field with "1aaaa2bbbbbb3cccccc4ddddddF6=Exit' and display would look like

  1aaaa
2bbbbbb
3cccccc
4dddddd
F6=Exit

(NB. not so easy to see how it looks in this font - but I hope you get the idea)

Thinking about it, it may be a neater solution than using 300 formats.

Tony.
0
 
ShadowProgrammerCommented:
PS. If you need to allow the user to Input any data, you would have to split my single large field into whatever fits and accept that you lose 1 character per individual field/text.

This solution also doesn't really cater for having fields with different attributes, again if you need to say, have the heading highlighted then separate that field out.

Example. 2 large fields to maximise space available for Lines 3-11 and 13-15 (note attribute characters start on lines 2 and 12)

Line01:  HIGHLIGHTED HEADING
Line02: Input No: +66666         +
Line03:ooooooooooooooooooooo
Line04:ooooooooooooooooooooo
Line05:ooooooooooooooooooooo
Line06:ooooooooooooooooooooo
Line07:ooooooooooooooooooooo
Line08:ooooooooooooooooooooo
Line09:ooooooooooooooooooooo
Line10:ooooooooooooooooooooo
Line11:ooooooooooooooooooooo
Line12: Input No: +66666         +
Line13:ooooooooooooooooooooo
Line14:ooooooooooooooooooooo
Line15:ooooooooooooooooooooo
Line16:
Line17: F3=Exit  F1=Help


Tony.
0
 
pclarkeirlAuthor Commented:
Thanks Tony,
I have managed to get it working by sacrificing the 1st character of the 2nd format. I will give you the full points but just becore I close this off can I ask one more related question.

One of the solutions I was attempting to put together was to have an option to allow switching between the Window format display file and a standard format display file (for the scanner). This means two seperate display files and in the RPG code opening either display file A or B depending on the selection.  

The two display files are open with User control (UC) however combined there are more than 255 formats between the two files. because of this I am getting the following compile error

*** The number of input record formats exceeds 255 ***

Is there any simple way around this or do I need a seperate program for each display file.

regards

Pat
0
 
daveslaterCommented:
Hi
you can do it the original way by using the key word
CLRL(*NO) in the DDS


A                                      CLEAR(15)                  
A                                      VLDCMDKEY(15 'Any Valid Com
A                                      PRINT(QSYSPRT   )          
A                                      DSPSIZ(*DS3)                
A          R RFMT1                                                
A                                      OVERLAY                    
A                               O  2  1'THIS IS FORMAT 1'                  
A*--------------------------------------------------------------  
A          R RFMT2                                                
A                                      OVERLAY   CLRL(*NO)                  
A                               O  2 32'THIS IS FORMAT 2'                  

TEST1 RPG

C                     WRITERFMT1                                  
C                     EXFMTRFMT2                                  
C                     SETON                     LR              
Dave
0
 
ShadowProgrammerCommented:
What version of RPG are you using ?   RPG/400 or ILE ?

If you are using RPG/400 convert your program to ILE (use IBMs CVTRPGSRC command) and try that, ILE has removed many of the limitations of RPG/400.

Otherwise, I think you will have to have two programs.

Tony.
0
 
daveslaterCommented:
Ps
the answer to the question is that OVERLAY only overlays formats when they occupy different lines on the display.

so in example 1
the two formats are or lines 2 & 3 so overlay works

in example 2 they occupy the same line so it doesn't'


Dave
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 5
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now