AS400 Mid Range/CRTLF command

Advertisement


Question
Hi.  I wonder if you can help with this problem.
I'm trying to create a single member logical file (ARCHLST3) which provides a view of data from a number of members of one physical file (CMMP01).  The members are named with two character codes e.g. IM or PP.

             PGM        PARM(&MBRLIST)
             DCL        VAR(&MBRLIST) TYPE(*CHAR) LEN(35)           

             CRTLF      FILE(WCSCR40C/ARCHLST3) +                      
                          DTAMBRS((CMMDTA/CMMP01 (&MBRLIST)))          

/*           CRTLF      FILE(WCSCR40C/ARCHLST3) +                                 */
/*                        DTAMBRS((CMMDTA/CMMP01 (IM PP MC ED IT EP +  */
/*                        DA DE DT BM DP CC)))                                                */

If I use the commented out code above (which has a hard coded list of members) then the CRTLF works fine.  However, what I want to be able to do is determine that list of members at runtime via an RPG program, and pass them into this CL in the variable &MBRLIST.  When I do this I find that if &MBRLIST contains the two letter code for just one member e.g. IM or PP, then it works fine.  But as soon as &MBRLIST contains more than one member name (seperated by a space to try and replicate the format of the commented out code) the process fails with:
"CPF0001 received by UTLCRTLF at 1104. (C D I R)"

If I delve further into the job log I can see that it seems to treat the two member names as one:
"Value 'IM PP     ' for parameter DTAMBRS not a valid name.
Error found on CRTLF command."
i.e. the space does not seem to act as a seperator (it looks for a member called "IM PP" rather than one called IM and one called PP.

If you have any idea on how to resolve this it would be much appreciated as it's baffling everyone in our department!
Thanks very much,
Simon Keating.

Answer
My first guess would that when you key the member names on IBM's command line, IBM puts a separator character between the names.  I would enter the command into a CL program, then use the DSPPFM command to display the CL program as if it were a data file, then look for any possible separator character.  If it's there, you'll have to insert that character between member names in your &MBRLIST field.

If that doesn't lead you to an answer, write me at CONCISESYS@AOL.COM and I'll research it.

- Laird

AS400 Mid Range

All Answers


Answers by Expert:


Ask Experts

Volunteer


Concise Systems/Laird Scranton

Expertise

General AS/400, RPG/400, SDA and CL programming questions. AS/400 performance tuning.

Experience


Past/Present clients
CB Sportswear
Coca-Cola of New York
Encore Paper Company
Golub Corporation
HBO Home Video
Imperial Pools
Kaiser Permanente of NE New York
Mallinckrodt Medical
Marigold Foods
Manpower & Associates
National Datacomputers
New York State Easter Seals Society
New York State Food Merchants Association
Pepsi-Cola Allied Bottlers
Petricca Construction
Taconic Telephone Corporation
TOMRA Recycling
Unistress Corporation

©2012 About.com, a part of The New York Times Company. All rights reserved.