Tip

Using SDA to create printer files

Did you know you could use Screen Design Aid (SDA) to create printer files? All of us use SDA everyday to create screens, but the only tools we have for printer files are SEU, RLU and Code Designer. I have seen people code extraordinary printer files in SEU, but the mass of RPG programmers just do not do enough printer files to hone our skills to that level.

When creating a printer file, begin just like you would a typical screen. Select the screen size (80 or 132 column) and begin to layout the report in SDA. I prefer to design my printer files from the top down. First I create the HEADER then DETAIL, TOTALS if I need them, and finally the FOOTER. After you create each record, make sure you sort the source code by pressing F4 followed by F6. This will ensure that your source code is easy to read and maintain.

After you complete your design in SDA and sort the source code, exit without creating the screen. Next, edit the source code using SEU. Once opened, press F13 and change the type from DSPF to PRTF. Return to the source and delete the DSPSIZ statement. Next, remove any keyboard shifts of "Y". Now go down to the DETAIL, TOTALS and FOOTER and remove the line numbers, then place a "SPACEB(1)" at each record level. The last thing you do is change the display attributes from DSPF type to PRTF types. Press F14 (Find and Replace) and enter DSPATR(HI) on line one and HIGHLIGHT on line two. Press enter, then press F17 repeatedly until all instances have changed. Now do the same thing for DSPATR(UL) to UNDERLINE. Exit your source and compile.

You will find that after just two or three times, this will become very natural. Also look at the way you can create your column headings as one field and get an underline from column 1 to column 132. I can create a typical printer file in under 10 minutes and never have to go back to move fields around to line them up with one another.

About the author:Kohan is a senior programmer analyst for a software development company. He has worked with the AS/400 since 1990 and has learned how to use the platform to solve business problems. He is also an adjunct instructor, teaching AS/400 classes at his local state college.

Clarification

After this tip was sent out to readers, the author realized he forgot to include two steps:

There are two things you need to do to create a display file width of 132. First do what you did to client access, which is change the session default to 132. The other thing is, once you are in SDA at the "Work With Display Records" is to press F14 for file keywords. Put a "Y" in front of "Display Sizes" and press enter. Put a 1 on the "27 X 132" line and remove the "1" from the 24 X 80 line. Now just press enter until you return to the "Work With Display Records" and proceed as indicated in the tip.

--------------------------------------------------------------------
READER FEEDBACK
--------------------------------------------------------------------

Robert Horbach said:
This is extremely cumbersome and leaves much to be desired, particulary if trying to design reports beyond 132 columns. I would suggest making an investment in a software package called Report Design Aid ('RDA'), which looks like SDA and makes designing reports as easy as SDA.


This was first published in August 2000

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.