?
Solved

Accessing Mutlimember Files

Posted on 2004-09-01
10
Medium Priority
?
448 Views
Last Modified: 2012-06-21
Using the below command as part of a CL Program

DSPFFD     FILE(*USRLIBL/*ALL) OUTPUT(*OUTFILE) +
             OUTFILE(LIBRARY/FILENAME)  

This command list all files and fields in given library list
I'm using this Outputfile (Library/Filename) in a program to change the value of a particular Common 'Field' meeting certain critera for all the files in the library(*USRLIBL/*ALL).

 
Field Partno; change the value 445 to 544 for all files with Field Partno
with out specifying all file names the above command accomplishes this.

Problem:
But the only problem I have is when it encounters a multimember file it only outputs the first member of a mutlimember file, hence I cannot update the remaining multimember files leaving the update incomplete.
             
0
Comment
Question by:Philip_Lang
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
10 Comments
 
LVL 1

Accepted Solution

by:
SuperCCA earned 500 total points
ID: 11950974
Hi

The part of the object description output from DSPFFD is common to all members and hence the information is not provided at the memeber level.

To solve the probelm you need a second file that lists the members for each file. This can be obtained at the command (rather than API) level using DSPFD TYPE(*MBRLIST).

In your program you will need to loop through your existing processing for each member in the second output file.

Cheers
0
 
LVL 14

Expert Comment

by:daveslater
ID: 11954456
Hi
what you can do is use the

OVRDBF FILE(FILE) TOFILE(*FILE) MBR(*ALL)  

call mypgm

dltovr File

your program that is perfoming the update will then update all members in the file sprcified.

Dave
0
 
LVL 14

Expert Comment

by:daveslater
ID: 11954503
Ps
this will not work if you are using SQL.
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
LVL 1

Expert Comment

by:SuperCCA
ID: 11954737
Hmmm

Dave I don't think so if I've understood the question:

1. It is unclear how the update of the value is being performed but obviously if it is SQL there is no support for *ALL member overrides.

2. If the program doing the work is using some other generic approach such as Program Described Files then it would be necessary to repetitively OPEN and CLOSE the target file within the "mypgm" for the override to take effect.

Cheers
0
 
LVL 14

Expert Comment

by:daveslater
ID: 11955498
Hi SuperCCA

I think it is a generic approach that is required, ie get the file, field and field position from the DSPFFD.
This can then be passed to a CL the will perform the override and then pass the field position to the RPG / Cobol program can then use a program described file to substring the relevant data check the value and perform the update.

This would lend itself to the mbr(*all) method.As all records in all members will be processed.
The override would need changing
OVRDBF FILE(FILE) TOFILE(*FILE) MBR(*ALL)  

to
OVRDBF FILE(internalfile) TOFILE(requiredfile) MBR(*ALL)  

Dave

0
 
LVL 1

Expert Comment

by:SuperCCA
ID: 11956443
Dave

Hang about, the last thing we want is for the chap to get involved with generic program described files. What if it's packed or binary data? The code is unnecessarily nasty, SQL is the way to go on this one.

Colin
0
 
LVL 14

Expert Comment

by:daveslater
ID: 11957972
Hi
You are of course right. I just love being techie - it’s my biggest downfall I just get carried away :-) and I do need some one to say Dave what are you thinking.

Dave
0
 
LVL 27

Assisted Solution

by:tliotta
tliotta earned 500 total points
ID: 11959467
Philip_Lang:

You apparently have nearly all of the logic you need. You now need to add the logic to process against each member.

Personally, the first thing I'd probably do is delete all records from your LIBRARY/FILENAME outfile where WHFLDE<>'PARTNO' just to keep it clean.

Then, I'd read the remaining records one at a time. Each record should give you a unique library and file name combination. I'd feed that into a command like this:

  DSPFD FILE(&WHLIB/&WHFILE) TYPE(*MBRLIST)  +
      OUTPUT(*OUTFILE) FILEATR(*PF) +
      OUTFILE(QTEMP/MBRLIST)

Now you can read from that file one record at a time. For each one that has MLNRCD>0 do:

  OVRDBF   &WHFILE  TOFILE( &WHLIB/&WHFILE )  +
      MBR( &MLNAME )

  RunSql  'update &WHFILE set Partno = 544 where...'

  DLTOVR  &WHFILE

The details of the RunSql command are up to you. A QM Query can be used or whatever technique gets you there. The point is that you want to issue the OVRDBF to point SQL to each member and then do the DLTOVR to remove the override before looping back to process the next member for that file. The MLNRCD>0 is an extra piece that says only do it for the current member if the member actually has some records in it.

Since the SQL standard has no useful concept of "members", the OS/400 non-default members are processed by using overrides before executing the SQL.

After you've processed every member for a file, read the next record from your original LIBRARY/FILENAME outfile, display its members into your second outfile, process all those members, etc.

It shouldn't be but a few more lines of code,

Tom
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An introduction to the wonderful sport of Scam Baiting.  Learn how to help fight scammers by beating them at their own game. This great pass time helps the world, while providing an endless source of entertainment. Enjoy!
Learn how to use the free Acronis True Image app to easily transfer data between iPhones and Android phones.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month10 days, 4 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question