Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 1191
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: 1191
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 How to include a particular field val... sakrat DFSORT/ICETOOL 8 Fri Apr 06, 2018 8:27 pm
No new posts Limit in Length for a CICS START seahawk789 CICS 6 Mon Apr 02, 2018 8:34 pm
No new posts Extract the records with a PD field's... sudhakar84 DFSORT/ICETOOL 11 Mon Apr 02, 2018 7:26 pm
No new posts Searching a table for the field name? socker_dad COBOL Programming 8 Sat Mar 31, 2018 2:57 am
No new posts VSAM File free space sancraig16 JCL & VSAM 13 Fri Mar 30, 2018 1:02 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us