Question

Tips to writing out extended subfile records conditionally

Asked by: ChuckMason

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!

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-04-03 at 13:08:32ID24293631
Tags

AS400 RPG Subfile

Topics

Programming for iSeries / AS400

,

RPG Programming Language

Participating Experts
3
Points
500
Comments
11

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Multiple overlay files
    I'm currently working on a DOS program that uses overlays. As the Turbo Pascal Overlay Unit only can produce one overlay file(.OVR), I'm wondering how I can produce multiple separated overlay files to collect different functions in my program. (I wanna group them up) Are ther...
  2. DirectDraw: Overlays.
    I need many infos about Overlays. 1st of all, if i ask the question, it's because it didn't work of course on my computer. What is the recommended hardware for Overlays? 2nd, i used GetCaps DDCAPS ddcaps; HRESULT ddrval; ddcaps.dwSize = sizeof( ddcaps ); ddcaps....
  3. as400 overlay
    I have a program in the as400 that when I print I would like to include an overlay with it. Right now we print out the overlay from the as400 then load the paper back in the printer and then go to the program and print it out. What I would like is to just be able to go to ...
  4. Overlay Limitation - Need to combine two overpay spool fil…
    My company has a system where we can fax a PO to a vendor via Fax400. The problem is that we have two spool files (with overlays) that get faxed at the same time: Spool1: The actual PO (multiple pages using an overlay) Spool2: The Terms and Conditions (different overlay of ...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: daveslaterPosted on 2009-04-06 at 00:08:06ID: 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

 

by: ChuckMasonPosted on 2009-04-06 at 05:52:52ID: 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!

 

by: daveslaterPosted on 2009-04-06 at 06:04:07ID: 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

 

by: ChuckMasonPosted on 2009-04-06 at 06:23:10ID: 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
    • 3 KB

    Example of current and future screen.

 

by: daveslaterPosted on 2009-04-06 at 07:01:28ID: 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

 

by: ChuckMasonPosted on 2009-04-06 at 08:18:41ID: 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!

 

by: daveslaterPosted on 2009-04-06 at 08:44:11ID: 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

 

by: murphey2Posted on 2009-04-07 at 14:47:46ID: 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

 

by: ChuckMasonPosted on 2009-04-07 at 15:03:13ID: 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!

 

by: Gary_The_IT_ProPosted on 2009-04-08 at 00:34:09ID: 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

 

by: ChuckMasonPosted on 2009-04-08 at 07:38:05ID: 31566426

Thanks!

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...