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
 

 

To Get Length of a particular field which is delimited space

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
guptae

Moderator


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

PostPosted: Mon Mar 24, 2008 5:36 pm    Post subject: To Get Length of a particular field which is delimited space
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 Moderator


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

PostPosted: Mon Mar 24, 2008 8:31 pm    Post subject:
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: 1187
Location: Bangalore,India

PostPosted: Mon Mar 24, 2008 10:08 pm    Post subject:
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 Moderator


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

PostPosted: Mon Mar 24, 2008 11:22 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts outrec field outside range Danielle.Filteau SYNCSORT 10 Sat Mar 04, 2017 2:37 am
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm


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