Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Truncating a record using JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Truncating a record using JCL
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 Moderator


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

PostPosted: Thu Aug 02, 2007 4:33 am    Post subject:
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    Post subject: Re: truncating a record using JCL
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    Post subject:
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

Senior Member


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

PostPosted: Thu Aug 02, 2007 10:51 am    Post subject:
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    Post subject:
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

Senior Member


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

PostPosted: Thu Aug 02, 2007 2:29 pm    Post subject:
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 Moderator


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

PostPosted: Thu Aug 02, 2007 9:27 pm    Post subject:
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

Senior Member


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

PostPosted: Fri Aug 03, 2007 12:33 pm    Post subject:
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 Moderator


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

PostPosted: Fri Aug 03, 2007 9:07 pm    Post subject:
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

Senior Member


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

PostPosted: Mon Aug 06, 2007 12:15 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts query to fetch record which has only ... maxsubrat DB2 3 Mon Dec 11, 2017 5:03 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm
No new posts Squeeze record left so that zeroes ar... Vignesh Sid SYNCSORT 5 Fri Nov 10, 2017 1:40 pm
No new posts Formatting multiple records to a sing... Vignesh Sid SYNCSORT 3 Tue Nov 07, 2017 12:22 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us