Loading

SORT in Easytrieve

You can Sort a file into another file in Easytrieve. The Syntax is

 SORT file-name-1 +
 TO file-name-2 +
 USING (field-name [D]...) +
 [BEFORE proc-name]

Let us see a couple of sample programs to explain.

Simple Sort on a key

The below program will simply

 FILE INFILE FB(80 960)
   ACCOUNT-NO  1 8 N
*
 FILE OUTFILE
*
 SORT INFILE TO OUTFILE USING ACCOUNT-NO

being updated..

Related Posts




blog comments powered by Disqus

There's 3 Comments So Far

  •   Satya Vvv
    March 8th, 2012 at 3:06 am

    Can we use Value clause in occurs statement in Easytrieve?
    If we use, will the initialized value applies for all occurences?

    Ex:
    F1 W 101 A OCCURS 100 TIMES
    F2 F1 100 A
    F3 F1 +100 1 A VALUE ‘,’

    In the above example, the comma is getting populated in only occurence. How to get the same in all occurences.

  •   Lakshmy
    May 28th, 2013 at 8:40 am

    Hi Karhik,

    This post is regarding the julian to gregarion date conversion of packed decimal field.
    input file–date is starting at 201 and length of 4 bytes
    i have used the outrec as below.
    554:201,4,DT1,EDIT=(TTTT-TT-TT)
    for example:input date:2011002
    output should be dispalyed as:2011-01-02 however with the above code year is getting dispalyed as 3911…can you please look into the issue.
    I have used the centwin parameter as 80

  •   Karthik
    May 28th, 2013 at 2:45 pm

    I think, in mainframes, Julian date is only 5 digits; so your input should be 11002 to get output as 2011-01-02

Share your thoughts, leave a comment!