How to format a flat file using customised FMTSRC

250 pts.
Tags:
AS/400
AS/400 Subfiles
DDS
FMTDTA
Hi, I have a falt file.i want to sort it using a customised format source file.Please tell me how to create a source file for formatting the flat-file.I want the sample of a DDS of sort.

Software/Hardware used:
as400

Answer Wiki

Thanks. We'll let you know when a new response is added.

first you need to create a source member to store the sort soecs.
We use QFMTSRC
here is the contents of a member ACHSRC and the FMTDTA command from the CL program.

<pre>
HSORTR 29A X
FNC 95 113
FNC 124 133
FDC 1 133

FMTDTA INFILE((*LIBL/ACHNEW)) OUTFILE(*LIBL/ACHNEW) +
SRCMBR(ACHSRC) OPTION(*NOPRT *NOSECLVL)</pre>

Discuss This Question: 7  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • TomLiotta
    At the moment, I can't find a decent link to describe source statements for the Sort (FMTDTA) command. The best that I can find is in SEU help text. Create a source member with type SRT, SRT38 or SRT36. Each one has different SEU line prompts, but they all tend to work out the same. When you start a SEU edit session over the source member, type "IP?" in the sequence number field to request a list of valid input prompt types.
    • A SRT member shows 'REFORMAT/SORT' prompts of RH,RR,RFand RC.
    • A SRT38 member shows 'REFORMAT' prompts of RH,RR and RF.
    • A SRT36 member shows 'SORT' prompts of SH,SR,SC and SF.
    Choose each of the prompt types for the type of member that you created. When the prompt is displayed in the SEU edit window, press <F1> to see the help for each field in that specification type. Press <F2> to see the extended help for the entire specification type. Press <F14> to print a copy of the help that is being displayed. By printing the extended help for all of the prompt types, you will have a simple set of documentation. That all I can give unless I can track down the old manuals on-line. Tom
    125,585 pointsBadges:
    report
  • MurrayInfoSys
    Try this:
      publib.boulder.ibm.com/iseries/v5r1/ic2924/books/c0918260.pdf
    The other Phil
    940 pointsBadges:
    report
  • jbapbecker
    Book no longer exists at that link. Anyone know where I can find more info?
    80 pointsBadges:
    report
  • GregManzo
    Better yet, don't even bother with sorting. Just create a physical file & a key (either on the PF or as a LF based over it), then just write data to the file & read it back via the key.
    This is *why* we have an integrated DBMS.
    1,635 pointsBadges:
    report
  • jbapbecker

    Hi Greg,

    Yeah but you're missing the point a bit. I seriously doubt anyone is looking for the information to WRITE any new fmtsrc. However, there may still be a lot of legacy PGMs (as is my case) that need maintained or in fact re-written as you have mentioned..To do this though, you first need to understand what the legacy PGM is doing.

    80 pointsBadges:
    report
  • ToddN2000
    @jbapbecker: I agree that sometimes it may be best to rewrite this old legacy code. A few reasons come to mine is some older commands may have support dropped in the future and the other is performance.. You may actually get to save the amount of coding by using the newer commands and built in functions. It all comes down to the resources available as to what will work best for you. IF there is a particular piece of code causing a problem post it and we will try and help figure it out... Sounds like you may be working with an old RPG 1 or RPG 2 program...Ah the old days it was probably written in the late 70's or early 80's I'm guessing.
    82,030 pointsBadges:
    report
  • TheRealRaven
    Try this for an on-line Sort User's Guide.
    21,845 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: