Solved

Tips to writing out extended subfile records conditionally

Posted on 2009-04-03
11
3,506 Views
Last Modified: 2013-11-25
I have written many subfile RPG programs.  I have a need for a program to one of the following:  (1) write out an extended sub file record (record 1,2,3 my be extended - taking up 2 lines each, record 4,5,6 may not be extended - taking up 1 line each.
(2) write out the sub file, then be able to overlay one of the subfile records with a different layout.  (While writing out the subfile, I will know that I need an extra line, so I will write a blank subfile record, then do I will go back and overwrite the subfile record.
(3) be able to write different record formats in the same subfile:

The subfile would look like the following:

Customer    Item          Date
ABC Cust   Wedge1   5/15/09
    Forcast of 30
CDE Cust   Wedge2    5/30/09
    Forecast of 50
FGH Cust   Wedge3   5/30/09
    Forecast of 25
AAA Cust  Wedge4   5/30/09
BVB Cust   Wedge5  5/30/09

Thanks!
0
Comment
Question by:ChuckMason
11 Comments
 
LVL 14

Expert Comment

by:daveslater
ID: 24074908
Hi
there is no way to write different records in a subfile, If you are simply using the subfile for output this is what I have done in the past:
1. Create one field on the Subfile, character(79)
2. Using the RPGLE BIF's ie EDTCDE, build up the string as you wish to see it
3 Output the string along with a hidden record ID.


you can use diffeent data structures to hold the subfile formats.

Quick and easy to maintain.

Dave
0
 

Author Comment

by:ChuckMason
ID: 24076796
Thanks for your input.  However the above will not work for me as each column has a different color and I need the individual fields to display the correct color.  The DDS manual references an "OVERLAY" option.  For the description, I gather that I can write a normal subfile out (While writing out I know that record 3 will have an subfile line, so I write an extra subfile line after record 3.  At the end, I write a record that "Overlays"  the subfile for this record.  Footers appear to be treated this way, but I cannot seem to get it to work.  Any examples would greatly be appriciated!!
Thanks!
0
 
LVL 14

Expert Comment

by:daveslater
ID: 24076882
Hi the colours are quite easy to do, they are simply hex codes are teh start of a field
20 Normal Green
21 Reverse image Green, reverse image
22 High intensity White
23 High intensity, reverse image White, reverse image
24 Underscore Green, underscore
25 Underscore, reverse image Green, underscore, reverse image
26 Underscore, high intensity White, underscore
27 Nondisplay Nondisplay
28 Blink Red
29 Blink, reverse image Red, reverse image
2A Blink, high intensity Red, high intensity
2B Blink, high intensity, reverse image Red, high intensity, reverse image
2C Blink, underscore Red, underscore
2D Blink, underscore, reverse image Red, underscore, reverse image
2E Blink, underscore, high intensity Red, underscore, blink
2F Nondisplay Nondisplay
30 Column separator Turquoise, column separator
31 Reverse image, column separator Turquoise, column separator, reverse image
32 High intensity, column separator Yellow, column separator
33 High intensity, reverse image, column separator White, reverse image, column separator
34 Underscore, column separator Turquoise, underscore, column separator
35 Underscore, reverse image, column separator Turquoise, underscore, reverse image, column parator
36 Underscore, high intensity, column separator Yellow, underscore, column separator
37 Nondisplay Nondisplay
38 Blink, column separator
39 Blink, reverse image, column separator Pink, reverse image
3ABlink, high intensity, column separator Blue
3B Blink, high intensity, reverse image, column separator Blue, reverse image
3C Blink, underscore, column separator Pink, underscore
3D Blink, underscore, reverse image, column separator
Pink, underscore, reverse image
3E Blink, underscore, high intensity, column separator Blue, underscore
3F Nondisplay Nondisplay
0
 

Author Comment

by:ChuckMason
ID: 24077033
Wow!  I was not aware that this could be done.
The next problem is that some of the fields are input capable (Use can modify the data)
I have attached an example of the current screens/programs along with the "Future" screen.
The current screen does reuse some of the fields already.  I was hoping the "OVERLAY" option would work.  
I have tried the FOLD/UNFOLD which works ok, just the owner wants to see more data lines on the page.
If I cannot use the overlay option, I will modify the screen similar to what was done in the past (reuse predefined fields).
Thanks!!
Metlfab.txt
0
 
LVL 14

Expert Comment

by:daveslater
ID: 24077348
Hi
It looks like the input fields occupy their own space on the sreen - if that is the case you can use indicators to:
a. Display the colour
b. Protect the field, if you use the ChgInpDft commnad to can remove the input underline so the screen looks like a continues output field.


Dave
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:ChuckMason
ID: 24078223
Dave:
This is what I have done in the past.  Just protected the input fields, changed the color on the display fields and put the data for the extra lines into existing datafields.
I may go back to the above approach.

Thanks again!
0
 
LVL 14

Expert Comment

by:daveslater
ID: 24078517
I was thinking about other options; this is a bit more long winded bit gives you a massive amount of control.

Read the records into a multi occurance data structure, this would be the same process as populating your subfile.
Create x (x being the number of lines in the SFL F0401, f0402 etc..)  number of identical formats with the same field names, you need to code the RTNDTA keyword. and a different start line
Write  each of the formats dependtant on the ccurance of the MODS and what the record is.
The rtndta then allows you to read each of the formats as with the press of a single enter key


Example

   Write Header
   Write F0401 ;
   Write F0402 ;
   Write F0403 ;
...
   Write F0404 ;
   Exfmt  F0413 ;

   Read F0401 ;
   Exsr Validation ;

   Read F0402 ;
   Exsr Validation ;

....


Dave
0
 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 24092311
Hi ChuckMason,

is it an option to make the screens extended with fold, so that initialy only 1 line is visible untill a Fkey is pressed?
or.... what about forgetting the subfile and makke 2 diferent 1 and 2 line screens with a variable startline?


Regards,
Murph
0
 

Author Comment

by:ChuckMason
ID: 24092417
Murph:
Thanks.  I have a version of the program running with the fold/drop function key.  The problem is that the customer does not want 2 lines to show for every record.  He only wants 2 lines to show when there is data to be displayed on the second line.  Typically there are 20 records to be displayed on the screen.  2 of these records would have extra information to be displayed.
I have taken Dave's approach above and defined several of my output only fields as one field.  Then conditionally output a extra subfile record in the same format. (Using an indicator to turn off the unneeded fields on the second subfile record.

According to the DDS manual, what I want to do is possible (using OVERLAY and PUTOVR in the DDS), I just can't get it to work :(
Thanks again!
0
 
LVL 34

Accepted Solution

by:
Gary Patterson earned 500 total points
ID: 24094633
I think what you want to do is a variable-length subfile record.  With a variable-length subfile record, you can have one record take up one line, another take up two, and another take up three.  There are a couple of "gotchas":  

1) You must code a subfile-page-equals-subfile-size (Page-At-A-time) subfile to do this.  See page 4-19 of the Application Display Programming manual:  
2) You have to keep track of how many screen lines you are using.

http://publib.boulder.ibm.com/iseries/v5r1/ic2924/books/c4157150.pdf

I've never tried to do it in two passes before, though, that I can recall.  You may need to restructure your program to gather all the data and then build the subfile once you have all the data you need.  You can change the contents of a subfile record using relative access:  CHAIN by record number, alter the contents, and UPDATE.

I don't think OVERLAY and PUTOVR work quite the way you think the do:

OVERLAY just allows you to put a record format on screen without erasing the entire display first.  You see OVERLAY used on the second and subsequent record formats that you write to a screen, generally:

WRITE ERRCTL (no overlay - we want to erase the screen first, then display the error subfile)
WRITE FKEYS (overlay - we don't want to erase the error subfile)
EXFMT SFLCTLR (overlay - we don't want to erase the error subfile or function key record format)
 
OVERLAY doesn't have anything to do with overlaying individual records inside a subfile.

PUTOVR (plus OVRATR and OVRDTA) allows you to alter the attributes or contents of fields already on the display in order to reduce the amount of data that is sent when a screen doesn't need to be changed much.  It is there to allow you to save communications bandwidth.  It doesn't allow you to do anything that you can't do by sending the whole screen (or a whole record format).  For example, if you already have an entire screen displayed,and you just need to change the contents of one field, or change the attribute of one field, then you use PUTOVR at the record format level to tell the system that it does not need to send the entire record format every time, and you specify and condition OVRDTA or OVRATR at the field level to indicate that you are just going to update that particular field or attribute.

See page 3-18 of the Application Display Programming manual for details and examples.

- Gary Patterson

varlensfl.jpg
0
 

Author Closing Comment

by:ChuckMason
ID: 31566426
Thanks!
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Moving applications to the cloud or switching services to cloud-based ones, is a stressful job.  Here's how you can make it easier.
In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now