AS400 Logical Built - How to build logic with variable naming

I have a physical file where the last two digits of the name are division number and are determined by the user's selection.  (example: XDSOPNL17), multiple file can exist at one time for different divisions.  I would like to build a logical file for these.  (example: XDSOPNL171)  I have tried a few different methods, but the relationship is not established.  The file and logical are built, but when I used DSPDBR.... the logical is not listed.  These files are built and deleted on the fly... not a one time thing.  I will show the DDS(s) I'm using and the commands in a screencast.   Can do listings if needed.

Thank You for your assistance.   lynn-harris-421884.flv
lynn_harrisAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Gary PattersonConnect With a Mentor VP Technology / Senior Consultant Commented:
When you create a LF (CRTLF), the system first looks at the PFILE keyword.  If a file name AND LIB is specified, then the logical is created over that specific file in that specific lib.

If no lib is specified on the PFILE keyword, then the system searches the LIBL of the job running the CRTLF command and attaches the logical to the first physical it finds in the LIBL with the name that matches the PFILE keyword.

Compile-related solutions:  Include a specific lib in the PFILE keyword, or make sure the lib containing the physical you want to use is at the top of the LIBL before you compile.

You could also use a create and rename approach.  Create the files using your "master" name, and then rename them.

- Gary Patterson
0
 
Gary PattersonVP Technology / Senior Consultant Commented:
Lynn,

Two things come to mind: library list, and PFILE keyword:

1. Look for another copy of the physical higher in the library list at compile time.  This is the most likely issue.

2. Also check the PFILE keyword in the LF and make sure the correct file name (and library, if a lib used) is specified.

- Gary
0
 
_b_hConnect With a Mentor Commented:
Gary is right; the logical is built over something!

Use Display File Description (DSPFD) on the logical file to see what physical file it is based on:
DSPFD WRDATAX/CDSOPNL171
and search for 'Based on file'

Hope this helps!
Barry
0
 
lynn_harrisAuthor Commented:
Hi Guys,

Yes, the logical is built on the PF specified in the PFILE keyword on the LF definition.  The problem is my lack of knowledge on building PF and LF files.  We have a in house job which allows us to add the LDA to the beginning of the file name (which is really the company identifier) and build that PF.  The logical is then built over the PF with the LDA not the PFILE in the keyword.  I have always use these commands and not needed the actual CRTPF/CRTLF commands much.   When I use the CRTPF/CRTLF commands (not the in house commands)  the logical is always built on the file named the the PFILE Keywork in the LF DDS.  

Let me rephrase the question.  I would like to use one PF DDS and one LF DDS to build multiple files with a one digit company identifier at the beginning of the DDS name and a two digit division code at the end.  Can this be done?

(I will look at modifying the in-house program.  Any insight you can provide is appreciated.)

Thanks,
Lynn
0
 
lynn_harrisAuthor Commented:
Thanks Gary,

That makes sense.  I like the create and rename approach.

Lynn
0
All Courses

From novice to tech pro — start learning today.