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
 

 

Character Length of a field in Sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Character Length of a field in Sort
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

Site Director


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

PostPosted: Wed Apr 21, 2010 9:22 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Wed Apr 21, 2010 11:41 pm    Post subject:
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 Moderator


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

PostPosted: Thu Apr 22, 2010 1:24 am    Post subject:
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    Post subject:
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    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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts Alter &DATENS field in HEADER1 Angad DFSORT/ICETOOL 4 Mon Apr 24, 2017 11:49 am


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