File-Aid Tips.

A Mainframe-Tip a Day keeps the bugs away!
Forum rules
All of these Tips/Tuning-suggestions should be tested your own, at your shop, prior to use in Prod.
Post Reply
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

File-Aid Tips.

Post by Anuj Dhawan »

This section on File-Aid Tips provides examples of File-AID control cards that solve specific problems. We try to organized example here as follows:
  1. State the problem
  2. Show the control cards required and the JCL
However, as multiple members can post in here - the above order might distort in between. If you see that's happening have a feedback on it, please post use back here: Follow up on Tips

COBOL and PL/I Data Format Abbreviations
Please go through these data format abbreviations which are used by File-AID when the FPRINT function or parameter is used to print records with the SHOW=FORMAT parameter - you can refer this post when you see FPRINT being used.
Table 1: COBOL data format abbreviations
COBOL Data Format Abbreviations.jpg

Table 2: PL/I data format abbreviations
PLI Data Format Abbreviations.jpg

PS.: Click on pictures for a better quality view.
You do not have the required permissions to view the files attached to this post.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Frequently used commands in FileAid.

Post by Anuj Dhawan »

1. Basic skeleton JCL for the File-Aid batch execution:

Code: Select all

//JOBNAME JOB JOB CARD INFORMATION 
//STEPNAME EXEC PGM=FILEAID,REGION=? 
//STEPLIB DD DSN=File-AID LOAD LIBRARY NAMES  
//STEPCAT DD DSN=CATALOG NAME 
//SYSPRINT DD SYSOUT=* 
//SYSLIST DD SYSOUT=* 
//SYSTOTAL DD SYSOUT=* 
//DDxx DD DSN=INPUT DATASET NAME 
//DDxxO DD DSN=OUTPUT DATASET NAME 
//DDxxRF DD DSN=REFORMAT DEFINITION DATASET NAME 
//DDxxRL DD DSN=RECORD LAYOUT DATASET NAME 
//DDxxRLN DD DSN=COMPARE NEW DATASET - RECORD LAYOUT DATASET NAME 
//DDxxXR DD DSN=XREF DATASET NAME (XREF MEMBER) 
//DDxxXRN DD DSN=COMPARE NEW DATASET - XREF DATASET NAME (XREF MEMBER) 
//DDxxSC DD DSN=SELECTION CRITERIA DATASET NAME (SC MEMBER) 
//DDxxSCN DD DSN=COMPARE NEW DATASET - SELECTION CRITERIA DATASET NAME (SC MEMBER) 
//DDxxCP DD DSN=COMPARE CRITERIA DATASET NAME 
//DDxxC DD DSN=NEW COMPARE DATASET NAME 
//DDxxCOn DD DSN=NEW COMPARE OUTPUT FILES 
//ANYNAME DD DSN=OUTPUT DATASET NAME 
//SYSIN DD * (CONTROL CARDS) 
/* 
//
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Frequently used commands in FileAid.

Post by Anuj Dhawan »

3. Copy dataset - many to many

Code: Select all

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

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Frequently used commands in FileAid.

Post by Anuj Dhawan »

4. Conditional copy

Code: Select all

//STEPCOPY EXEC PGM=FILEAID 
//DD01     DD DSN=T1300AD.INPUT1,DISP=SHR 
//DD01O    DD DSN=T1300AD.OUTPUT1,DISP=OLD 
//SYSOUT   DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//SYSLIST  DD SYSOUT=* 
//SYSTOTAL DD SYSOUT=* 
//SYSIN    DD * 
$$DD01 COPY IF=(534,GE,P'8'),IF=(1234,EQ,C'9')  
/*


The example is self explanatory.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Frequently used commands in FileAid.

Post by Anuj Dhawan »

5. This example show how to use AND and IF together.

This Job copy those records which has character '9999' at location 8 and characters not equal to 'AD' at location 22 or character '123' at location 9 and '1' at location 60.

Code: Select all

//STEPCOPY EXEC PGM=FILEAID 
//DD01     DD DSN=T1300AD.INPUT1,DISP=SHR 
//DD01O    DD DSN=T1300AD.OUTPUT1,DISP=OLD 
//SYSOUT   DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//SYSLIST  DD SYSOUT=* 
//SYSTOTAL DD SYSOUT=* 
//SYSIN    DD * 
$$DD01  COPY IF=(8,EQ,C'9999'), 
             AND=(22,2,NE,C'AD'), 
             ORIF=(9,EQ,C'123'), 
             AND=(60,EQ,C'1')
/*
//*
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Frequently used commands in FileAid.

Post by Anuj Dhawan »

6. Below JCL shows how to use COPY, IF, OUT and PRINT in File-Aid batch Job. The JCL copies the first 9 records that contain the characters '675' at position 11. It also prints the first 5 selected records, these records are printed in the File-Aid's DD SYSLIST.

Code: Select all

//STEPCOPY EXEC PGM=FILEAID 
//DD01     DD DSN=T1300AD.INPUT1,DISP=SHR 
//DD01O    DD DSN=T1300AD.OUTPUT1,DISP=OLD 
//SYSOUT   DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//SYSLIST  DD SYSOUT=* 
//SYSTOTAL DD SYSOUT=* 
//SYSIN    DD * 
$DD01  COPY IF=(11,EQ,C'675'),OUT=9,PRINT=5 
/*
//*
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: File-Aid Tips.

Post by Anuj Dhawan »

7. In this File-Aid Batch job an example is shown with using COPY and MOVE. It copies six repetition of the characters 'IBM' to the output.

Code: Select all

//STEPCOPY EXEC PGM=FILEAID 
//DD01     DD DSN=T1300AD.INPUT1,DISP=SHR 
//DD01O    DD DSN=T1300AD.OUTPUT1,DISP=OLD 
//SYSOUT   DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//SYSLIST  DD SYSOUT=* 
//SYSTOTAL DD SYSOUT=* 
//SYSIN    DD * 
$$DD01  COPY MOVE=(1,6C'IBM')
/*
//*
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: File-Aid Tips.

Post by Anuj Dhawan »

8. Below Job is a combination of COPY and OUT. It copies the first 60 records to the output data set.

Code: Select all

//STEPCOPY EXEC PGM=FILEAID 
//DD01     DD DSN=T1300AD.INPUT1,DISP=SHR 
//DD01O    DD DSN=T1300AD.OUTPUT1,DISP=OLD 
//SYSOUT   DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//SYSLIST  DD SYSOUT=* 
//SYSTOTAL DD SYSOUT=* 
//SYSIN    DD * 
$$DD01  COPY OUT=60
/*
//*
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: File-Aid Tips.

Post by Anuj Dhawan »

9. Below Job is a combination of COPY and PRINT. It copies the input dataset while printing the first 15 records.

Code: Select all

//STEPCOPY EXEC PGM=FILEAID 
//DD01     DD DSN=T1300AD.INPUT1,DISP=SHR 
//DD01O    DD DSN=T1300AD.OUTPUT1,DISP=OLD 
//SYSOUT   DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//SYSLIST  DD SYSOUT=* 
//SYSTOTAL DD SYSOUT=* 
//SYSIN    DD * 
$$DD01  COPY PRINT=15
/*
//*
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: File-Aid Tips.

Post by Anuj Dhawan »

10. Below Job is a combination of COPY, SELECT, OUT and IF. It creates an extract file of every fourth input record that contains a value of '123' at location 8. A maximum of 100 such records are copied.

Code: Select all

//STEPCOPY EXEC PGM=FILEAID 
//DD01     DD DSN=T1300AD.INPUT1,DISP=SHR 
//DD01O    DD DSN=T1300AD.OUTPUT1,DISP=OLD 
//SYSOUT   DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//SYSLIST  DD SYSOUT=* 
//SYSTOTAL DD SYSOUT=* 
//SYSIN    DD * 
$$DD01 COPY SELECT=4,OUT=100,IF=(8,EQ,C'123')
/*
//*
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: File-Aid Tips.

Post by Anuj Dhawan »

10. This Job will copy input data-set but drop records containing '123' at location 8. Also stop copying after 10 records.

Code: Select all

//STEPCOPY EXEC PGM=FILEAID 
//DD01     DD DSN=T1300AD.INPUT1,DISP=SHR 
//DD01O    DD DSN=T1300AD.OUTPUT1,DISP=OLD 
//SYSOUT   DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//SYSLIST  DD SYSOUT=* 
//SYSTOTAL DD SYSOUT=* 
//SYSIN    DD * 
$$DD01 DROP IF=(8,EQ,C'123'),OUT=10
/*
//*
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: File-Aid Tips.

Post by Anuj Dhawan »

11. Using pointer mechanism: 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: Select all

//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
/*
//*
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Shahid
Registered Member
Posts: 47
Joined: Sun Aug 25, 2013 1:00 am

Re: File-Aid Tips.

Post by Shahid »

This is an excellent collection and helped me a lot.

Thanks Anuj.
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: File-Aid Tips.

Post by Anuj Dhawan »

Great to know that they had been helpful...:)

Regards,
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: File-Aid Tips.

Post by Anuj Dhawan »

12. Combination of SPACE, STOP, DUMP and IN. it prints the record with '123' at location 8 and the next five records.

Code: Select all

//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 STOP=(8,4,C'123') 
$$DD01  DUMP  IN=6
/*
//*
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: File-Aid Tips.

Post by Anuj Dhawan »

13. Following Job 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: Select all

//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')
/*
//*
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: File-Aid Tips.

Post by Anuj Dhawan »

14. This Job shows the combination of COPY and EDITALL. This eliminates all occurrences of the string 'ABC' and 'GHI' because the new data is a NULL.

Code: Select all

//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 EDITALL=(1,50,C'ABC,GHI',C' ')
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: File-Aid Tips.

Post by Anuj Dhawan »

15. When you want to verify a file which has got many fields and you want to check 2 or 3 fields - file-aid provides a means to do that. For example, if you want to check only 1st, 2nd and 8th fields in the file, issue, DISPLAY 1,2,10 ONLY on command line and it'll display only these fields once you are browsing the file using a copybook layout.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: File-Aid Tips.

Post by Anuj Dhawan »

16. Following JCL shows a combination of UPDATE, IN and REPLACE.

This Job will make permanent changes to an existing data set. Two UPDATEs used in the Job - The first update places the pointer at a particular record and the second UPDATE replaces the data.

Code: Select all

//STEPCOPY EXEC PGM=FILEAID 
//DD01     DD DSN=T1300AD.INPUT1,DISP=SHR 
//DD01O    DD DSN=T1300AD.OUTPUT1,DISP=OLD 
//SYSOUT   DD SYSOUT=* 
//SYSPRINT DD SYSOUT=* 
//SYSLIST  DD SYSOUT=* 
//SYSTOTAL DD SYSOUT=* 
//SYSIN    DD * 
$$DD01  UPDATE IN=100 
$$DD01  UPDATE REPL=(65,EQ,C'ANUJDH','DHAWAN')/*
//*
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “Tip Of the Day.”