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

Character Length of a field in Sort


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

New User


Joined: 25 Jun 2008
Posts: 19
Location: Chennai

PostPosted: Wed Apr 21, 2010 9:01 pm
Reply with quote

Is it possible to find the length of the string in a field (field - defined by columns). If yes I need the length of that string in the same record. End of the string within the specified field is determined by successive space characters.

For example, Input file has some data from column 1 to 9 of variable length.

Code:
ABCDEFG
HIJKL MN
OP QRS
T UVW


Output file should have the records with the length following them

Code:
ABCDEFG     7
HIJKL MN    8
OP QRS      6
T UVW       5
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Apr 21, 2010 9:22 pm
Reply with quote

Hello,

How would this value be used?

If you explain the real goal, there should be less iterations to deal with the additional parts of the requirement. . .
Back to top
View user's profile Send private message
spradeepece

New User


Joined: 25 Jun 2008
Posts: 19
Location: Chennai

PostPosted: Wed Apr 21, 2010 9:31 pm
Reply with quote

icon_smile.gif

Ok.. Here is my real goal..

I have a flat file of record length of 3096 (FB file). I have records with messages of variable lengths, defined in Char format.

I need to load these records to a table, where this field is defined as Varchar. For a varchar, I need to know the length of the record to have it prefixed before the actual message.

The base line here is conversion of a data, from Char to Varchar using sort.
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: Wed Apr 21, 2010 11:41 pm
Reply with quote

You can use OUTFIL with FTOV,VLTRIM=C' ' to convert the records to VB with an RDW (length is in 1,2,BI). Then you can subtract 4 from the 1,2,BI value to get the length of the data up to the first nonblank character.

Can the length be 1-3096? Do you want to display the data (up to 3096 bytes) with the length after it? If you show what you really want for output, I can show you how to do it.
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 Apr 22, 2010 1:24 am
Reply with quote

Here's a job that will do what you asked for in your first post. You can change it appropriately for other situations.

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=...  input file (FB)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB)
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
COPY FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
  OUTFIL FNAMES=T1,FTOV,VLTRIM=C' '
/*
//CTL2CNTL DD *
  OUTFIL VTOF,
    BUILD=(5,9,X,1,2,BI,SUB,+4,TO=ZD,LENGTH=1)
/*
Back to top
View user's profile Send private message
spradeepece

New User


Joined: 25 Jun 2008
Posts: 19
Location: Chennai

PostPosted: Thu Apr 22, 2010 5:03 pm
Reply with quote

Frank,

It worked.. Thanks a lot..
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 Store the data for fixed length COBOL Programming 1
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
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 Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top