PMS Information Systems
Welcome to PMS Information Systems - IBM i (AS/400) Forum !!!

Get Answers for all your queries on IBM i (AS/400).

how to create DDS of pf for given parameters

View previous topic View next topic Go down

how to create DDS of pf for given parameters

Post  balaragunath on Fri Apr 26, 2013 8:32 pm

I need help from you guys,

How can I create the DDS of a PF from given parameters,
The parameters are.Library name,Object name and Source file name.

Output: DDS of PF in any assigned library/Source file.

For this create a Command with will accept all the above parameter and finally create a DDS of PF.

Note: Don't suggest to do in CRTPF command, It will create only Flat PF. I want DDS Like record format name and fields..

balaragunath

Posts : 1
Join date : 2012-09-13

View user profile

Back to top Go down

HOW TO CREATE DDS OF PF FOR GIVEN PARAMETERS

Post  arifg2005 on Fri May 17, 2013 6:09 pm

Hi Bala,

Its interesting one, hey guys if u have object of the PF but source is not available how can we create.
Here is the solution for that. You need to do with CLP and RPGLE

Make two outfiles using DSPFD and DSPFFD. for example you have to create the outfile like below

Pass the parameter of original file object and its library.

DSPFFD FILE(&LIBNAME/&FILNAME) OUTPUT(*OUTFILE) OUTFILE(LIBNAME/FIELDOUT)
FIELDOUT is outfile name..Give the name whatever you want. after this command you runqry the outfile, you can get the field details related to that File name.

DSPFD FILE(&LIBNAME/&FILENAME) TYPE(*ACCPTH) OUTPUT(*OUTFILE) OUTFILE(LIBNAME/KEYOUT)
KEYOUT is outfile name..Give the name whatever you want. after this command you runqry the outfile, you can get the key field details related to that File name. Those commands are done with CLP and call the RPG program

Now you have fields and key field names in that out files.

After this step create a flat file.
Read the two outfiles get the details like record format name,len,type etc., and write all the details into flat file. Positioning the fields,attributes and Record format is important. Because if any one of the fields is not in right position then your DDS will be wrong..This will done in RPGLE program

After this copy the flat file into particular source file. for ex:

CPYF FROMFILE(LIBNAME/FLATFILENAME) +
TOFILE(LIBNAME/QDDSSRC) +
FROMMBR(*FIRST) TOMBR(&FILNAM) +
MBROPT(*REPLACE) CRTFILE(*YES) +
FMTOPT(*CVTSRC)

&FILNAM is nothing but original object of the PF which passing the parameter into this program.

Using this copy file now DDS of PF member has been create in that source file.

Now you open the file DDS will be available like original PF.

arifg2005

Posts : 3
Join date : 2012-03-15
Age : 33
Location : Chennai

View user profile

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum