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

Insert data at end of variable-length record


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
suzeet

New User


Joined: 16 May 2005
Posts: 54

PostPosted: Tue May 21, 2013 2:46 pm
Reply with quote

Hi,
I have a VB file of record length 100. I want to add 4 bytes of '0000' at the end of each record. For Example:
Input Record
Record 1: 80 bytes
Record 2: 50 bytes

Output record should be of 104 record length and of VB
The record 1: 80bytes+4 bytes '0000'
Record 2: 50 bytes+4 bytes '0000'
Can it be doable in SORT?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue May 21, 2013 3:13 pm
Reply with quote

Well, if you can wait, first until September, then until your site moves up to z/OS 2.1, then it will be easy :-)

Quote:
In z/OS V2.1 DFSORT, several usability enhancements are planned. DFSORT will be designed to support new alphanumeric tests for both compare fields and parse fields, including combinations of alphanumeric character sets (uppercase and lowercase, and numeric). This support is intended to allow you to specify various sets of characters using a single compare condition or PARSE keyword rather than using compare conditions or PARSE keywords. Also, enhancements are planned for symbol processing, allowing symbols to be used for more DFSORT operands, and the number of parse fields supported is planned to be increased from the prior limit of 100 fields to 1,000 fields. Finally, new support is planned to allow you to specify that a string up to 50 characters in length be appended to variable-length output records.


Until that time, can you describe your records a bit more?

Do they have a "fixed" part and then a "variable" part? Or are they entirely variable? Do they contain just "character" data, or do you have any non-character fields (binary, packed-decimal)?
Back to top
View user's profile Send private message
suzeet

New User


Joined: 16 May 2005
Posts: 54

PostPosted: Tue May 21, 2013 3:28 pm
Reply with quote

Quote:
Do they have a "fixed" part and then a "variable" part? Or are they entirely variable? Do they contain just "character" data, or do you have any non-character fields (binary, packed-decimal)?


Yes, there will be fixed part. The first 10 bytes is fixed and rest 90 bytes variable block.
They do contains only character fileds.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue May 21, 2013 4:25 pm
Reply with quote

Code:
  OPTION COPY
  INREC   IFTHEN=(WHEN=INIT,
                   FINDREP=(IN=C' ',OUT=X'FF',STARTPOS=15)),
          IFTHEN=(WHEN=INIT,
                   OVERLAY=(101:X)),
          IFTHEN=(WHEN=INIT,
                   FINDREP=(IN=C' ',OUT=C'0000',STARTPOS=15,DO=1)),
          IFTHEN=(WHEN=INIT,
                   FINDREP=(IN=X'FF',OUT=C' ',STARTPOS=15))
  OUTFIL VLTRIM=C' '


Change all the (significant, in that we want them on the output) spaces in a record to X'FF.

Overlay immediately after the last byte of the existing maximum, one blank. If there are records shorter than the maximum, the intervening bytes will be padded with EBCDIC space.

Now, change, once only, a space to C'0000'. The first four bytes after the existing data are now "0000", but there are trailing blanks (potentially) as well.

Change the X'FF's back to significant spaces.

Use OUTFIL with VLTRIM=C' ' to drop off the unnecessary trailing blanks which were generated by padding and/or the OVERLAY.

When you have DFSORT 2.1, change the Control Cards to the nice new ones :-)
Back to top
View user's profile Send private message
suzeet

New User


Joined: 16 May 2005
Posts: 54

PostPosted: Wed May 22, 2013 11:08 am
Reply with quote

Wow! It works like a charm...Thanks Bill
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top