Displaying data through DSPF and CL programm.!

80 pts.
Tags:
CL
CL Program
CL programming
DSPF
PF
I would like to be able to display one record from my PF with DSP file through a CL program on my screen. I have these sources: CL program: ******************************************** QSYSPRT          1  QPADEV0021  USERNAME      pgm              DCLF       FILE(MyLib/SPOOLTMP) RCDFMT(S) +                                  OPNID(DSP)                                                                                                           DCLF       FILE(Mylib/SPOOLTEMP) RCDFMT(SPOOLTEMP) +                           OPNID(PF)                                                                                                            RCVF       DEV(*FILE) RCDFMT(SPOOLTEMP) OPNID(PF)                SNDRCVF    DEV(*FILE) RCDFMT(SPOOLTMP) OPNID(DSP)                                                                           endpgm                                                           ******************************************** PF: *************** Beginning of data *********************                  R SPOOLTEMP                                                                OBJLINK       20A                                                                                                              ****************** End of data ************************ DSPF: *********** Beginning of data *************************************************  A*%%TS  SD  20090826  131635  USERNAME      REL-V5R4M0  5722-WDS                 A*%%EC                                                                         A                                      DSPSIZ(24 80 *DS3)                      A          R SPOOLTMP                                                          A*%%TS  SD  20090826  131635  USERNAME      REL-V5R4M0  5722-WDS                 A            OBJLINK   R        O  4  8REFFLD(SPOOLTEMP/OBJLINK MYLIB/SPO-     A                                      OLTEMP)                                ******************************************************************************* The result is when I call CL programm nothing happens! No data is displayed. I don't know what to do? :(

Software/Hardware used:
AS400, i5OS

Answer Wiki

Thanks. We'll let you know when a new response is added.

Add this statement after the RCVF
CHGVAR &DSP_OBJLINK &PF_OBJLINK

Discuss This Question: 7  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

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
  • Littlepd
    Well, I really wanted to be able to provide you with an answer for this one. But it's been so long since I wrote a CL program that used files, I don't have any examples that use more than 1. That used to be the limit, BTW. You could only declare 1 file in a CL program. (I think they changed it in V5R4.) This brings me to the real reason I wanted so badly to respond to this questions: Why? Why do you want to use the wrong language to do this task? CL is IMHO the worst language on the IBM i that you could pick to read data from a file and display it on the screen. CL is, by definition, a language designed for system control. That means object creation and manipulation, setting permissions, preparing the environment for running a program, etc. If you want to read data from a file and display it on the screen, I would STRONGLY suggest picking a language that is vastly better suited to that task, like COBOL, RPG, C, Java, or SQL. (I'm climbing down from my soapbox now.)
    1,130 pointsBadges:
    report
  • Avrelivs
    Thank you for posting. I am completely aware of the fact that CL is not designed to be data file manipulation langauage. But I have no way out of this. I have to make it work :o(
    80 pointsBadges:
    report
  • bvining
    Littlepd, Actually CL programs now have the strongest database capability of any procedural language available on the system. The PowerCL: Control Language for File (CLF) product (note that my company developed the product) provides a command interface to database files, display files, and printer files that is a superset of what is provided by full procedural files in RPG, COBOL, and C. There is no longer any need to write a RPG/COBOL/C/Java program if the program function fits well in a CL environment and all you need is file support to accomplish the task from CL. Multiple files are supported and the support for using common data (by field name) across the multiple files is much improved over IBM CL multi-file support. Bruce Vining
    6,620 pointsBadges:
    report
  • Avrelivs
    Firs of all I would like to sincerely thank all of you for helping me out. CharlieBrowne thank you for the line. I implemented it and it worked fine. It was in fromt of my nose all the time :o) I also wanted to display more than one record in PF but it is an obvoius CL obstacle. I'm now experimenting with multiple records within DSPF to display more records with OVRDBF in CL programme. It's kinda hairy :o)) I haven't heard for Power CL. Is that IBM product or?
    80 pointsBadges:
    report
  • bvining
    It's a relatively new product developed by ex-IBMers in Rochester. The product has a precompiler (fee based) which makes file usage from CL a snap (one beta user was able to replace a 150 line RPG program with a 50 line CL program for instance), removes the need for CHGVARs when working with data across files (if the field names are the same in the files), etc. The product also has a no-charge run-time which also allows direct file usage from CL. Without the precompiler you can still add/read/update/delete database records, work with display files (including subfiles), work with printer files, etc. but you don't get anywhere near the productivity gains (you have to CHGVAR data across files like you do with IBM provided multi-file support, you have to manage varying length fields yourself like with IBM provided support, you don't get the RPG-like syntax commands (like CHAIN, SETLL, READE, ...) just the CL-syntax command (like ReadRcdCLF, PosDBFCLF, etc). This option is for those with CL knowledge and more time than money :)
    6,620 pointsBadges:
    report
  • bvining
    If you're interested this article was published today by MC Press and shows some of the CLF capabilities (using the precompiler with CL-syntax commands, using the precompiler with RPG-syntax commands, and using the no-charge run-time support). The article is actually the 4th in a series but the first three don't utilize the CLF product (though they do set up the scenario explaining the 4th article).
    6,620 pointsBadges:
    report
  • TomLiotta
    If you want to display more than one record from your PF, you might be better off not using DDS to create the display file. You could use UIM to create a list panel or use the DSM APIs to avoid creating a DSPF at all. Or if this is just a basic utility function for yourself, you could even create a simple multi-row DFU for the DSPDTA command. Tom
    125,585 pointsBadges:
    report

Forgot Password

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

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

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

Thanks! We'll email you when relevant content is added and updated.

Following