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

Truncating a record using JCL


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
marvs13th

New User


Joined: 22 Jun 2007
Posts: 5
Location: philippines

PostPosted: Thu Aug 02, 2007 4:26 am
Reply with quote

Hi;

I had an input file(i.e. INFILE1) which have a record length of 87. My specs requires that the last 7 characters of INFILE1 to be strip using a JCL code WITHOUT SORTING the file.

In summary:
INFILE1 (LRECL=87) ===> OUTFILE1 (LRECL=80)

I tried the PGM=IEBGENER but I have problem in truncating the record.....
Need your asist here thanks icon_smile.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Aug 02, 2007 4:33 am
Reply with quote

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN                                               
//SYSOUT    DD  SYSOUT=*                                               
//SORTIN DD DSN=...  input file (FB/87)               
//SORTOUT DD DSN=...  output file (FB/80)         
//SYSIN    DD    *                                                     
  OPTION COPY                                                           
  INREC BUILD=(1,80)                             
/*                     
Back to top
View user's profile Send private message
marvs13th

New User


Joined: 22 Jun 2007
Posts: 5
Location: philippines

PostPosted: Thu Aug 02, 2007 5:16 am
Reply with quote

Thank you.....the code works icon_smile.gif
Back to top
View user's profile Send private message
0d311

Guest





PostPosted: Thu Aug 02, 2007 9:38 am
Reply with quote

Or using IEBGENER,


Code:

//IEBGENER EXEC PGM=IEBGENER                               
//SYSPRINT DD  SYSOUT=*                                   
//SYSOUT   DD  SYSOUT=*                                   
//SYSUT1   DD DSN=input.dsn.fb87,DISP=SHR     
//SYSUT2   DD DSN=output.dsn.fb80,DISP=(NEW,CATLG,DELETE),               
//         DCB=(LRECL=80,RECFM=FB)             
//SYSIN    DD *                                           
 GENERATE  MAXFLDS=1                                       
 RECORD  FIELD=(80,1,,1)                                 
/*                                                         
Back to top
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Aug 02, 2007 10:51 am
Reply with quote

Frank,

A small question here: In your JCL if one don't code
Code:
INREC BUILD=(1,80)
then also the code should suffice.
Please let me know if it changes the processing speed of JOB.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Thu Aug 02, 2007 11:59 am
Reply with quote

anuj_model
If you dont include
Code:
INREC BUILD=(1,80)
, then o/p file would have the LRECL of 87 not 80, and hence wont suffice!

Quote:
Please let me know if it changes the processing speed of JOB.

Anuj, as i had pointed you earlier to this link http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ice1ca20/3.8.1?ACTION=MATCHES&REQUEST=inrec,outrec,efficiency&TYPE=FUZZY&SHELF=ICE1SH20.bks&DT=20060615185603&CASE=&searchTopic=TOPIC&searchText=TEXT&searchIndex=INDEX&rank=RANK&ScrollTOP=FIRSTHIT#FIRSTHIT
It states a following point => Performance can be improved if you can significantly reduce the length of your records with INREC. INREC and OUTREC should not be used unless they are actually needed to reformat your records.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Aug 02, 2007 2:29 pm
Reply with quote

krisprems wrote:
then o/p file would have the LRECL of 87 not 80, and hence wont suffice!
Hi,

When you code the LRECL=80 in the DCB of outout file, then even if you don't code INREC BUILD=(1,80) output will shrink to LRECL 80. What I thought is, INREC will make SORT to work on only 80-characters of input file instead of taking all 87-characters during COPY process.

P.S.: I think, I've mixed the DCB (of output files) of IEBGENER JCL to SORT. icon_redface.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Aug 02, 2007 9:27 pm
Reply with quote

Anuj,

Yes, it's true that if you use LRECL=80 on the //SORTOUT DD, DFSORT will truncate the output records to 80, and doing it that way would probably be more efficient than using INREC or OUTREC to truncate the records. However, in terms of "documentation" and avoiding pitfalls, there's something to be said for using INREC or OUTREC to set the record length explicitly rather than depending on the LRECL of the DD statement.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Aug 03, 2007 12:33 pm
Reply with quote

Thanks for the clarification Frank.
Frank Yaeger wrote:
Yes, it's true that if you use LRECL=80 on the //SORTOUT DD, DFSORT will truncate the output records to 80, and doing it that way would probably be more efficient than using INREC
But if you have a larger file of say, LRECL=400 or more & some million-records, & you code INREC BUILD=(1,80) to get LRECL of 80 in output instead of codeing LRECL=80 in DCB of SORTOUT, don't you think INREC will sigificantly reduce the processing speed of that JOB, as INREC will mask only first 80-characters of input for the COPY process of SORT, whilst without INREC system will process the whole chunk of data?

Please advise.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Aug 03, 2007 9:07 pm
Reply with quote

I tried this and the INREC step was actually slower. INREC requires extra processing to reformat every record.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Aug 06, 2007 12:15 pm
Reply with quote

Frank Yaeger wrote:
I tried this and the INREC step was actually slower. INREC requires extra processing to reformat every record.
Thanks Frank, for enganging your valuable time for my rather stupid query.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Aug 06, 2007 5:23 pm
Reply with quote

Quote:
I tried this and the INREC step was actually slower. INREC requires extra processing to reformat every record.

Okay, this is the reason the documentation says
Quote:
INREC and OUTREC should not be used unless they are actually needed to reformat your records.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top