tnt400.com - AS/400 Tips And Techniques

Sponsored by news400.com

This page is a discussion on the mentioned topic.
Most of the answers are in their original posted form, including any technical/spelling/grammatical errors.
No guarantees are expressed or implied. :-)
Comments, corrections, concerns about this tip?

Got another AS/400 question? Ask it here


What's New?
See what's new at Tips-N-Tech.

AS/400 Tips-N-Tech
AS/400 tips, techniques, and FAQ. Updated frequently.
CODEPage/400
All the code samples you can eat! RPG, CL, DDS, etc. etc.
AS/400 FAQs
The official news400.com FAQs.






All AS/400 Tip Categories / AS/400 Programming / Help: AS/400 subfiles


Question:

Writing file maintenance program for open purchase order file. Typically provide a view screen in add-change-delete maintenance programs. However this program involves header and detail physical files with a logical file required for the detail record handling. Also the view portion will look at all detail records of a PO at the same time. Can I use the same subfile definition for the add and change transaction? Typically the PO generation program would add POs, but I want to include it here also. Can you also reccommend a good book with examples for subfile processing.


Answer(s):








Get the book, "Subfile Technique for RPG/400 Programmers 2nd Edition" By Jonathan Yergin and Wayne Madden. From DUKE Press (www.news400.com). It has source examples of order entry subfiles. It's a good book, I used it to learn more of the other subfile techniques.




Michael Catalani's "Subfiles for RPG Programmers" from Midrange Computing is decent. He takes you from basic to complex subfile design in a nice, progressive manner. Lots of detailed RPG III code and display file examples. A glaring omission is a lack of information about coding subfiles to allow option selection on a subfile line item, except by using cursor position. He promises he will cover doing this by option number 'later', but never does unless I've missed something. And sometimes new keywords and concepts appear in the examples without any explanation in the text. But overall, it is a useful book. Also, Pence & Hawkins' "Power RPG III" and "Power RPG IV" books (also MC) have brief, but informative sections on subfiles, again with examples. They do explain one technique for performing option selection on a subfile by option number.




Yes, i would think so. When ready, chain to the file with an indicator in 54-55. If the indicator is on, write the record. if the indicator is off, update it.




I think I know what you're asking for. We have many screens like this, including PO entery and Order Entry. Let me see if I have this straight.. here's an example of what I think you want. Purchase Order Entry Vender: _________ PO#:____________ any other header data (leave this area blank to update selected detail lines one at a time) Select options, press Enter. 2=Change 4=Delete Opt PO Line Purchase# Qty Cost Ext. Cost _ 1 Item1 1 2.45 2.45 _ 2 Item2 3 4.23 12.69 _ 3 Item3 2 1.00 2.00 .... ... ... F3=Exit F6=Add F12=Cancel message line ------------------------------------------------ So, this will not only display what is on the PO, but will also allow update of the PO lines. Use the option field to select lines to update, and display the PO line data in the area noted above (This is because there will most likely be more info that can be updated on the subfile line itself, also makes it a little easier). When enter is hit, update the PO detail file. When all lines that were selected have been updated, reload the subfile do display new changes in the subfile. I made this display with IBM standards to make it easier to understand. F6 will display blank data in the detail line screen area with an incremented detail line number. Simple enuff.... Did this help at all?





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


You are at a news400.com site.
Contact Us | Report Bugs | Submit Comments/Suggestions | Read Site Use Agreement | Read Privacy Policy
Copyright © 2000 Duke Communications International.
This site is best viewed with the latest versions of Netscape or Internet Explorer, 800 x 600 resolution (or higher), and at least 256 colors.
Duke Communications   NEWS/400 | 29th Street Press | Business Finance | DominoPro | Selling AS/400 Solutions | SQL Server Magazine | Windows NT Magazine