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
ASKED:
August 26, 2009 2:07 PM
UPDATED:
October 11, 2009 10:50 AM
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.)
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
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
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
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
I haven’t heard for Power CL. Is that IBM product or?
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
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).
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