View previous topic :: View next topic
|
Author |
Message |
amalraj_ece
New User
Joined: 16 Jul 2006 Posts: 21 Location: delhi
|
|
|
|
I have a file which is 32756 VB length file. The actual data in this file again is varied length. For example, first record is 841 length and second record is 994 etc. I want to add a hex character X '0A' at the end of each record. Can you help me with this? |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
What happens should one or more records be a length of 32756 ? |
|
Back to top |
|
|
amalraj_ece
New User
Joined: 16 Jul 2006 Posts: 21 Location: delhi
|
|
|
|
I have to do this through JCL (may be through SAS or Sort or any other utility). |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
I berlieve you misunderstood Expat's queston.
What happens when the record is already the maximum length before the x'0A' is appended? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
This is easy to do in SAS as long as none of the records are already 32756 bytes long. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
so what is the easy SAS solution when a record is 32756 before the addition of the extra byte to add the linefeed? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Code: |
DATA _NULL_;
LENGTH DATALINE $ 32767;
INFILE DDIN LENGTH=RL;
INPUT @;
RECLEN = RL;
INPUT @1 DATALINE $VARYING. RECLEN;
SUBSTR(DATALINE, RECLEN+1, 1) = '0A'X;
RECLEN + 1 ;
FILE DDOUT;
PUT DATALINE $VARYING. RECLEN; |
and as I said
Quote: |
as long as none of the records are already 32756 bytes long. |
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Robert,
My question was _ what happens when a record is already at max length? |
|
Back to top |
|
|
|