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

To Get Length of a particular field which is delimited space


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

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Mon Mar 24, 2008 5:36 pm
Reply with quote

Hi All,

I just wanted to get length of a varchar fields in which its delimited by space & starting position is known

Eg:

Empno Emp name dept
11 Nataraj.Ganesh IDC
12 Priyank.bhatt MDC
13 GUPTAE IDC

Here I want the length of emp name which is variable in nature & it should be preceeded empname & should be in two byte binary.

Please let me know if I am not clear enough
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: Mon Mar 24, 2008 8:31 pm
Reply with quote

What is the starting position of the emp name field? What is the maximum length of the emp name field?

Do you want the output to look like this:

Code:

CH              BI-2
Nataraj.Ganesh  000E
Priyank.bhatt   000D
GUPTAE          0006


where the second field is a 2-byte binary value as shown in hex.

If not, what do you want the output to look like?
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Mon Mar 24, 2008 10:08 pm
Reply with quote

Hi Frank,

Apologiesfor not clear in my prev post.

Length of Empname is 20 bytes & its starting from 3 rd byte.
12345678901234567890123456789012345678901234567890
i/p :11nataraj.ganesh IDC
o/p:11.#nataraj.ganesh IDC

here i assume .& as the length of empname in 2 byte binary
Total record legth is 80 bytes.

Hope I am clear enough.
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: Mon Mar 24, 2008 11:22 pm
Reply with quote

Here's a DFSORT job that will do what you asked for (we could probably do a trick with converting the input to VB, getting the length from the RDW and converting back to FB, but using multiple IFTHENs is easier).

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/82)
//SYSIN    DD    *
   OPTION COPY
   INREC IFTHEN=(WHEN=INIT,BUILD=(1,2,3:X'0000',5:3,78)),
     IFTHEN=(WHEN=(6,1,CH,EQ,C' '),OVERLAY=(3:X'0001')),
     IFTHEN=(WHEN=(7,1,CH,EQ,C' '),OVERLAY=(3:X'0002')),
     IFTHEN=(WHEN=(8,1,CH,EQ,C' '),OVERLAY=(3:X'0003')),
     IFTHEN=(WHEN=(9,1,CH,EQ,C' '),OVERLAY=(3:X'0004')),
     IFTHEN=(WHEN=(10,1,CH,EQ,C' '),OVERLAY=(3:X'0005')),
     IFTHEN=(WHEN=(11,1,CH,EQ,C' '),OVERLAY=(3:X'0006')),
     IFTHEN=(WHEN=(12,1,CH,EQ,C' '),OVERLAY=(3:X'0007')),
     IFTHEN=(WHEN=(13,1,CH,EQ,C' '),OVERLAY=(3:X'0008')),
     IFTHEN=(WHEN=(14,1,CH,EQ,C' '),OVERLAY=(3:X'0009')),
     IFTHEN=(WHEN=(15,1,CH,EQ,C' '),OVERLAY=(3:X'000A')),
     IFTHEN=(WHEN=(16,1,CH,EQ,C' '),OVERLAY=(3:X'000B')),
     IFTHEN=(WHEN=(17,1,CH,EQ,C' '),OVERLAY=(3:X'000C')),
     IFTHEN=(WHEN=(18,1,CH,EQ,C' '),OVERLAY=(3:X'000D')),
     IFTHEN=(WHEN=(19,1,CH,EQ,C' '),OVERLAY=(3:X'000E')),
     IFTHEN=(WHEN=(20,1,CH,EQ,C' '),OVERLAY=(3:X'000F')),
     IFTHEN=(WHEN=(21,1,CH,EQ,C' '),OVERLAY=(3:X'0010')),
     IFTHEN=(WHEN=(22,1,CH,EQ,C' '),OVERLAY=(3:X'0011')),
     IFTHEN=(WHEN=(23,1,CH,EQ,C' '),OVERLAY=(3:X'0012')),
     IFTHEN=(WHEN=(24,1,CH,EQ,C' '),OVERLAY=(3:X'0013')),
     IFTHEN=(WHEN=NONE,OVERLAY=(3:X'0014'))
/*
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 Replace each space in cobol string wi... COBOL Programming 3
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