IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

File Aid Tips & Frequently used commands


IBM Mainframe Forums -> Compuware & Other Tools
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mdtendulkar

Active User


Joined: 29 Jul 2003
Posts: 237
Location: USA

PostPosted: Wed Apr 14, 2004 5:41 pm
Reply with quote

File-Aid Tips

Nowadays, We are seeing many posts asking for Frequently used commands in File Aid. So I thought of putting them together which will help all users.

I have listed few commands...if anybody know any more commands with examples, that will help others.

-------------------------------------------------------------------------------------


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.




General Structure
Code:

//STEPNAME EXEC PGM=FILEAID
//DD01     DD DSN=INPUT.FILE,DISP=SHR
//DD01O    DD DSN=OUTPUT.FILE,DISP=OLD
//SYSOUT   DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSLIST  DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//SYSIN    DD *


Using different SYSIN control cards we can have different functions of FILEAID.

Check for empty files

Code:

//CHKEMPTY EXEC PGM=FILEAID
//DD01     DD DSN=G1SG00AT.INFILE,DISP=SHR
//DD01O    DD DSN=DUMMY,
//         DISP=(NEW,CATLG,DELETE),
//         UNIT=SYSDA
//SYSOUT   DD *
//SYSPRINT DD SYSOUT=*
//SYSLIST  DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//SYSIN    DD DUMMY


If the input file is empty then this step will give RC = '08'. Trapping the return code of this step one can say whether the input file was empty.

Copy dataset - one to one

Code:

//STEPCOPY EXEC PGM=FILEAID
//DD01     DD DSN=G1SG00AT.INPUT1,DISP=SHR
//DD01O    DD DSN=G1SG00AT.OUTPUT1,DISP=OLD
//DD02     DD DSN=G1SG00AT.INPUT2,DISP=SHR
//DD02O    DD DSN=G1SG00AT.OUTPUT2,DISP=OLD
//SYSOUT   DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSLIST  DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//SYSIN    DD DUMMY      or code COPY as instream


Here by default SYSIN parameter is 'COPY'. Copy is done from DD01 to DD01O although DD02 and DD02O are coded.

Copy dataset - many to many

Code:

//STEPCOPY EXEC PGM=FILEAID
//DD01     DD DSN=G1SG00AT.INPUT1,DISP=SHR
//DD01O    DD DSN=G1SG00AT.OUTPUT1,DISP=OLD
//DD02     DD DSN=G1SG00AT.INPUT2,DISP=SHR
//DD02O    DD DSN=G1SG00AT.OUTPUT2,DISP=OLD
//SYSOUT   DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSLIST  DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//SYSIN    DD *
$$DD01 COPY
$$DD02 COPY
/*


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.

Code:

$$DD01  COPY IF=(8,EQ,C'275'),
             IF=(8,EQ,C'494'),
             ORIF=(8,EQ,C'195'),
             AND=(50,EQ,C'02')


Logical AND condition is coded using two contiguous IF statements. The combination of ORIF and AND creates another pair of logical AND condition.

Code:

$$DD01  COPY IF=(8,EQ,C'275'),
             AND=(60,2,NE,C'SU'),
             ORIF=(8,EQ,C'195'),
             AND=(50,EQ,C'0')


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.

Using pointer mechanism

Code:

//STEPNAME EXEC PGM=FILEAID
//DD01     DD DSN=INPUT.FILE,DISP=SHR
//DD01O    DD DSN=OUTPUT.FILE1,DISP=OLD
//SYSOUT   DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSLIST  DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//SYSIN    DD *
$$DD01  SPACE  IN=25
$$DD01  COPY OUT=6


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.

Replace

Code:

//STEPNAME EXEC PGM=FILEAID,PARM=TSO
//DD01     DD DSN=INPUT.FILE,DISP=SHR
//DD01O    DD DSN=OUTPUT.FILE1,DISP=OLD
//SYSOUT   DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSLIST  DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//SYSIN    DD *
$$DD01 COPYALL IF=(1,EQ,C'7,8'),
       REPL=(6,EQ,C'8000',C'8420'),
       REPL=(6,EQ,C'8001',C'8421'),
       REPL=(6,EQ,C'0405',C'8425'),
       REPL=(6,EQ,C'0406',C'8426'),
       REPL=(6,EQ,C'0407',C'8427'),
       REPL=(6,EQ,C'0408',C'8428')


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'.

Code:

$$DD01  COPY IF=(8,EQ,C'275'),
             ORIF=(60,EQ,C'SU'),
             REPL=(1,C'ABC')


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'.


Edit

Code:

//STEPNAME EXEC PGM=FILEAID,PARM=TSO
//DD01     DD DSN=INPUT.FILE,DISP=SHR
//DD01O    DD DSN=OUTPUT.FILE1,DISP=OLD
//SYSOUT   DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSLIST  DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//SYSIN    DD *
$$DD01 COPY  EDIT=(1,6,C'AAAA',C'BBBBBBBB')


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.

Code:

$$DD01  UPDATE IN=100
$$DD01  UPDATE REPL=(55,EQ,C'EXGLA','AAAAA')


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.

Accumulation and tallying

Code:

//STEPNAME EXEC PGM=FILEAID
//DD01     DD DSN=INPUT.FILE,DISP=SHR
//DD01O    DD DSN=OUTPUT.FILE1,DISP=OLD
//SYSOUT   DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSLIST  DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//SYSIN    DD *
$$DD01  ACCUM=(50,4,C,'TOTALS')


Accumulates the 4 byte field starting at position 50 and prints the total in SYSTOTAL and labels it as 'TOTALS'.

Code:

$$DD01 TALLY IF=(8,EQ,C'275'),
 IF=(60,EQ,C'SU'),
 ACCUM=(50,4,C,'TOTAL'),
             IF=(55,EQ,C'EXGLA'),
 ACCUM=(15,1,C,'SUBTOTAL')


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'.


Backward processing of records

Code:

//STEPNAME EXEC PGM=FILEAID
//DD01     DD DSN=INPUT.FILE,DISP=SHR
//DD01O    DD DSN=OUTPUT.FILE1,DISP=OLD
//SYSOUT   DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSLIST  DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//SYSIN    DD *
$$DD01  SPACEBACK  STOP=(8,0,C'423')
$$DD01  DUMPBACK  OUT=6


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.


User functions - split input file

Code:

//STEPNAME EXEC PGM=FILEAID
//DD01     DD DSN=INPUT.FILE,DISP=SHR
//FILE01   DD DSN=OUTPUT.FILE1,DISP=OLD
//FILE02   DD DSN=OUTPUT.FILE2,DISP=OLD
//FILE03   DD DSN=OUTPUT.FILE3,DISP=OLD
//SYSOUT   DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSLIST  DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//SYSIN    DD *
$$DD01 USER    IF=(28,EQ,C'BC4,BC9,BC5,DFC'),
               WRITE=FILE01,
               IF=(28,NE,C'BC4,BC9,BC5,DFC'),
               WRITE=FILE02


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.


Regards
Mayuresh Tendulkar
Back to top
View user's profile Send private message
mainframe2me

New User


Joined: 07 Mar 2005
Posts: 5
Location: gurgaon

PostPosted: Fri Sep 02, 2005 2:37 pm
Reply with quote

This is Madhav i am having one doubt in file aid

i am having a string "ABC"
i would like to change it to "123"

when i searched for it is shows that this "ABC" is effected to more than 10th proc , in one shot how can i change to "123".
Back to top
View user's profile Send private message
Rupesh.Kothari

Member of the Month


Joined: 27 Apr 2005
Posts: 463

PostPosted: Fri Sep 02, 2005 2:59 pm
Reply with quote

Hi Madhav,

I assule that yor word 'ABC ' is in n number of proces in a single PDS.

Firstly create a member "$$$COIBM" in your MYID.JOB.PDS.
Try the following code

Code:
//STEP     EXEC PGM=IPOUPDTE,PARM=UPDATE       
//SYSPRINT DD   SYSOUT=*                       
//@TEST    DD   DSN=MYID.JOB.PDS,DISP=SHR   
//SYSIN    DD   *                             
ABC<111<                               
/*     



Please open a new post for new topic.


Regards
Rupesh
Back to top
View user's profile Send private message
cgratna

New User


Joined: 16 Sep 2005
Posts: 1

PostPosted: Fri Sep 16, 2005 12:27 pm
Reply with quote

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.
Back to top
View user's profile Send private message
tgbalamanian

New User


Joined: 11 Mar 2005
Posts: 4
Location: chennai

PostPosted: Thu Sep 22, 2005 2:19 pm
Reply with quote

Hi ,

In File Aid , I am copying as well as sorting records.The control card used are

Code:
$$DD01 COPY IF=(018,EQ,C'05'),           
            AND=(27,EQ,C'H'),           
            AND=(127,EQ,C'M,I,P,Q'),     
            AND=(238,EQ,C'Y,MLX'),OUT=0 
SORT FIELDS=(157,3,A),FORMAT=CH         

The records are copied but the Sortfields is skipped. Is it correct or wrong ?

Thanks in Advance.
TGB
Back to top
View user's profile Send private message
sms2sanki

New User


Joined: 30 Sep 2005
Posts: 1

PostPosted: Fri Sep 30, 2005 6:25 am
Reply with quote

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
Back to top
View user's profile Send private message
badal

New User


Joined: 05 Sep 2004
Posts: 21

PostPosted: Mon Oct 17, 2005 6:46 pm
Reply with quote

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
Back to top
View user's profile Send private message
kkxlnc

New User


Joined: 12 Jun 2005
Posts: 44
Location: Boston

PostPosted: Mon Oct 17, 2005 7:39 pm
Reply with quote

Try these options to select last 100 records:

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.

Thanks and Regards,
KK.
Back to top
View user's profile Send private message
gadiyarampavan

New User


Joined: 22 Feb 2005
Posts: 18
Location: Hyderabad

PostPosted: Wed Mar 01, 2006 1:36 pm
Reply with quote

Hi Madhav,
I have a JOB in Jal. In this job i have steps haveing DD statements.

Code:
//job001 ....
//step001
//   dd1
//dd2
//dd3
//step002
//dd1
//dd2
//dd3


Suppose i want to override step002 of DD 's first and then DD's of step002
Is it possible using File Aid?
Back to top
View user's profile Send private message
aaripio

New User


Joined: 30 Mar 2006
Posts: 1

PostPosted: Thu Mar 30, 2006 9:31 am
Reply with quote

hi mdtendulkar

good quick crash course on File Aid commands. Thanks for the Tips.

icon_cool.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Compuware & Other Tools

 


Similar Topics
Topic Forum Replies
No new posts Unable to interpret a hex value to De... COBOL Programming 4
No new posts how to eliminate null indicator value... DB2 7
No new posts Format Binary file to EBCDIC JCL & VSAM 4
No new posts Binary File format getting change whi... All Other Mainframe Topics 7
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
Search our Forums:

Back to Top