Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Replace the value only for the last record.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Huan-Nguyen

New User


Joined: 17 Jan 2006
Posts: 17

PostPosted: Tue Nov 27, 2007 6:47 am    Post subject: Replace the value only for the last record.
Reply with quote

I need to replace the value @ and # to blank (space) only for the last record in the input file(record format VB and rec length 512)

Input file

Code:

123456789@@@
ABCD12456578NNNNN
NNNNNVVVVVVV
XXXXXXXXXXXXXMMMMMMMMM@@@@@NNNNNNNN###VVV


Expected Output

Code:

123456789@@@
ABCD12456578NNNNN
NNNNNVVVVVVV
XXXXXXXXXXXXXMMMMMMMMM     NNNNNNNN   VVV
Back to top
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Tue Nov 27, 2007 8:43 am    Post subject:
Reply with quote

Huan,

Is there a way to identify the last record directly?
Back to top
View user's profile Send private message
vkphani

New User


Joined: 29 Oct 2003
Posts: 29

PostPosted: Tue Nov 27, 2007 10:59 am    Post subject:
Reply with quote

Huan-Nguyen,

As it is only for teh last record you wanna change, why don't you just edit the file and put spaces.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Tue Nov 27, 2007 11:02 am    Post subject:
Reply with quote

Phani,

Quote:
As it is only for teh last record you wanna change, why don't you just edit the file and put spaces.

You suggestion might be good for dev file but not on PROD files.
Back to top
View user's profile Send private message
Huan-Nguyen

New User


Joined: 17 Jan 2006
Posts: 17

PostPosted: Tue Nov 27, 2007 11:13 am    Post subject:
Reply with quote

murmohk1 wrote:
Huan,

Is there a way to identify the last record directly?

I will change the design to identify the last record. Thanks,
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Tue Nov 27, 2007 12:29 pm    Post subject:
Reply with quote

Huan-Nguyen,

Please check with the folllowing code for your requirement.
Code:
//S EXEC PGM=SORT                                                   
//SORTIN DD DSN=XXXXX.YYYYYYY.V512,DISP=OLD                         
//SORTOUT DD DSN=&&SYMNAMES,DISP=(,PASS)                             
//SYSOUT DD SYSOUT=*                                                 
//SYSIN DD *                                                         
 OPTION COPY                                                         
 OUTFIL REMOVECC,NODETAIL,VTOF,BUILD=(80X),                         
 TRAILER1=(C'LASTREC,+',COUNT=(M11,LENGTH=8),80:X)                   
/*                                                                   
// EXEC PGM=SORT                                                     
//SORTIN DD DSN=XXXXX.YYYYYYY.V512,DISP=OLD                         
//SYMNAMES DD DSN=*.S.SORTOUT,DISP=(OLD,DELETE),VOL=REF=*.S.SORTOUT 
//SORTOUT DD DSN=XXXXX.YYYYYYY.V512.OUT,DISP=(,CATLG),               
// DCB=(XXXXX.YYYYYYY.V512),SPACE=(CYL,(1,1))                       
//SYSOUT DD SYSOUT=*                                                 
//SYSIN DD *                                                         
 OPTION COPY                                                         
 ALTSEQ CODE=(7B40,7C40)                                           
 INREC IFTHEN=(WHEN=INIT,OVERLAY=(513:SEQNUM,8,ZD)),               
 IFTHEN=(WHEN=(513,8,ZD,EQ,LASTREC),OVERLAY=(5:5,508,TRAN=ALTSEQ))
 OUTFIL OUTREC=(1,4,5,508)
/*                                       
//                                                                 

Input:
Code:
123456789@@@                             
ABCD12456578NNNNN                         
NNNNNVVVVVVV                             
XXXXXXXXXXXXXMMMMMMMMM@@@@@NNNNNNNN###VVV

Output:
123456789@@@
Code:
ABCD12456578NNNNN                         
NNNNNVVVVVVV                             
XXXXXXXXXXXXXMMMMMMMMM     NNNNNNNN   VVV
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: Tue Nov 27, 2007 10:53 pm    Post subject:
Reply with quote

Huan,

Shankar's "solution" will pad your variable length records with blanks so they will ALL be 512 bytes. So a record that was 20 bytes long will be increased to 512 bytes long. This is a very bad idea as it negates the reason for having a VB file. (This is a case of a little knowledge being a dangerous thing.)

Here's a DFSORT job that will do what you want and preserve your original record lengths:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (VB/512)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYM DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL FNAMES=T1,BUILD=(1,4,5:SEQNUM,8,ZD,13:5)
  OUTFIL FNAMES=SYM,NODETAIL,REMOVECC,VTOF,
    BUILD=(80X),
    TRAILER1=('TARG,+',COUNT=(M11,LENGTH=8))
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//SORTOUT DD DSN=...  output file (VB/512)
//SYSIN    DD    *
  OPTION COPY
  ALTSEQ CODE=(7B40,7C40)
  INREC IFTHEN=(WHEN=(5,8,ZD,EQ,TARG),
    BUILD=(1,4,5:13,TRAN=ALTSEQ)),
   IFTHEN=(WHEN=NONE,BUILD=(1,4,5:13))
/*
Back to top
View user's profile Send private message
Huan-Nguyen

New User


Joined: 17 Jan 2006
Posts: 17

PostPosted: Wed Nov 28, 2007 7:07 am    Post subject:
Reply with quote

Frank,

Thank you very much for your help. I will try to run it by tomorrow and will let you know the result . Thanks,
Back to top
View user's profile Send private message
Huan-Nguyen

New User


Joined: 17 Jan 2006
Posts: 17

PostPosted: Sat Dec 01, 2007 5:22 am    Post subject:
Reply with quote

Frank,

It works perfectly with your JCL. Many thanks,
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us