File Aid is a versatile utility that is basically used for re-formatting data while copying from another data set. Apart from several usage of this utility like copy data sets, concatenate datasets etc., FILEAID can also be used to check whether a file is empty or not. Below is the general structure of File Aid batch processing JCL.
Here DD01 is copied to DD01O and DD02 is copied to DD02O
Conditional copy
Code:
$$DD01 COPY IF=(776,GE,P'2'),IF=(1311,EQ,C'1')
In this example, copy input file data only if 776th digit is greater than or equal to 2 in packed digit format or if 1131st character is equal to '1'.
Code:
$$DD01 COPY IF=(14,EQ,C'173',14,EQ,C'326')
Multiple if entries are coded within a single IF parameter. It is a format to code logical OR conditions. If input record contains characters 173 or 326 at the location 14 then only they are copied to the output file.
Copy those records which has character '275' at location 8 and characters not equal to 'SU' at location 60 ro character '195' at location 8 and '0' at location 50.
Code:
$$DD01 COPY IF=(8,EQ,C'423'),OUT=5,PRINT=2
This is a combination of COPY, IF, OUT and PRINT. It copies the first 5 records that contain the string '423' at location 8 and prints the first 2 selected records. Here the printed records will go to DD name specified in SYSLIST.
Code:
$$DD01 COPY MOVE=(1,10C'ABC')
Combination of COPY and MOVE. It copies ten repetition of the string to the output location 1 through 30.
Code:
$$DD01 COPY OUT=60
Combination of COPY and OUT. It copies the first 60 records to the output data set.
Code:
$$DD01 COPY PRINT=15
Combination of COPY and PRINT. It copies the input dataset while printing the first 15 records.
Code:
$$DD01 COPY SELECT=4,OUT=100,IF=(8,EQ,C'423')
Combination of COPY, SELECT, OUT and IF. It creates an extract file of every fourth input record that contains a value of '423' at location 8. A maximum of 100 such records are copied.
Code:
$$DD01 DROP IF=(8,EQ,C'423'),OUT=10
Copy input dataset but drop records containing '423' at location 8. Also stop copying after 10 records.
The SPACE function is used to position the pointer at a specific record. The first control card places the pointer at the 25th record. The second control card copies the next 6 records.
Code:
$$DD01 SPACE STOP=(8,4,C'423')
$$DD01 DUMP IN=6
Combination of SPACE, STOP, DUMP and IN. it prints the record with '423' at location 8 and the next five records.
In this example, if character '7' or '8' is found in column 1 of input file and characters '8000' is found in column 6 of input file then it is replaced by characters '8240' in output file from column 6 onwards.
Code:
$$DD01 COPY RA=(1,60,C'ABCD',2C'XY')
Combination of COPY and REPLALL. It copies all input records while REPLALL parameter scans locations from 1 to 60 of each record and replaces all occurrences of the string 'ABCD' with 'XYXY'.
Combination of COPY, IF, ORIF and REPLACE. It copies the records that have characters '275' at location 8 or 'SU' at location 60. If location 60 has characters 'SU' then it overlays the data at location 1 with 'ABC'.
Replaces the string 'AAAA' with the string 'BBBBBBBB'. When the longer new data is inserted then the fields are shifted and when required compressed for spaces.
Code:
$$DD01 COPY EDITALL=(1,50,C'ABC,GHI',C' ')
Combination of COPY and EDITALL. This eliminates all occurrences of the string 'ABC' and 'GHI' because the new data is a NULL entry.
Combination of UPDATE, IN and REPLACE. It makes permanent changes to an existing data set. The first update places the pointer at a particular record and the second UPDATE replaces the data.
A combination of COPY, IF and ACCUM. the TALLY function binds the two ACCUM functions. It checks whether the first two IF conditions are satisfied. If so then the totals of the field from 50 to 54 are generated and labeled under the heading 'TOTALS'. For the second IF the field at location 15 is accumulated and labeled the heading as 'SUBTOTAL'.
It uses the back function which provides the backward processing of the records. SPACEBACK will do the backward processing of the records and stops at the record which satisfies the particular condition provided in the STOP parameter. The DUMPBACK will also do the backward processing and print such 6 records.
Here step checks 28th characters onwards in input file in characters mode. If field contains values 'BC4', 'BC9', 'BC5' or 'DFC' then output 1 is written else output 2 is written.
Code:
$$DD01 USER WRITE=FILE02,
IF=(55,EQ,C'EXGLA'),
MOVE=(55,C'SSSSS'),
WRITE=FILE02
Combination of USER, WRITE, IF and MOVE. The first WRITE parameter writes all the input records and if the selection criteria matches then it performs the MOVE and then repeats the records with the changed value in the output data set.
File aid is having two types one which is used for File operations and second one is used for DB2 (file aid for DB2). I found one more File Aid Tips.
File-AID is a cross platform file and data management solution. Developers need test data in order to develop new functionality and manage production problems related to your most business critical applications. File-AID provides quick and convenient access to the necessary data and files enabling developers to focus their time on actual development work instead of hunting around for data.
Hi,
I have a requirement like below
Input file length - 100
output file length - 60
copy all the records from input file column 41 to 100 into output file
How do I do this using File Aid.
Pls advise.
Thanks,
sms
HI,
i just want to copy last 100 records or 200 to 300 records i need to copy then how will i do that with the help of file aid?
thanks and regards/
Badal
Initial records to skip ===> 0 then skip this many records
Subsequent Selection Interval: then repeat the following
Records to select ===> 100 - select this many records
Records to skip ===> 0 - then skip this many records
until
Number of records to search ===> 100 you have read this many records
Number of records to select ===> 100 or selected this many records
SEQ/VSAM processing direction ===> B (F = Forward; B = Backward)
Try playing with these options and u will get what u want.