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
 
get length of variable length field

 
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: Sat Jun 11, 2011 12:00 am    Post subject: get length of variable length field
Reply with quote

I have a file which contains a variable length string. I want to calculate the length of that field and put it in first 2 bytes (hex value)

i/p file
xxabcdefghijklmno

o/p
abcdefghijklmno


when you browse it in hex its actually x'000f' in first two bytes
Back to top
View user's profile Send private message

Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1783
Location: Bloomington, IL

PostPosted: Sat Jun 11, 2011 12:14 am    Post subject: Re: get length of variable length field
Reply with quote

guptae wrote:
I have a file which contains a variable length string. I want to calculate the length of that field and put it in first 2 bytes (hex value)

i/p file
xxabcdefghijklmno

o/p
abcdefghijklmno


when you browse it in hex its actually x'000f' in first two bytes

Sounds like you've achieved your ambition icon_question.gif
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Sat Jun 11, 2011 12:53 am    Post subject:
Reply with quote

guptae,
Quote:
I want to calculate the length of that field and put it in first 2 bytes (hex value)
You are saying you want to put the length in first 2 bytes in output.

Quote:
i/p file
xxabcdefghijklmno

o/p
abcdefghijklmno
You sample data and expected output is completely reversed!!! Is that a typo? What is LRECL and RECFM of the input file?

Thanks,
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8201
Location: Dubuque, Iowa, USA

PostPosted: Sat Jun 11, 2011 1:08 am    Post subject:
Reply with quote

And what are you wanting the LRECL and RECFM of the output file to be?
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: Sat Jun 11, 2011 1:33 am    Post subject:
Reply with quote

Hi Enrico,

Quote:
I want to calculate the length of that field and put it in first 2 bytes (hex value)

Quote:
o/p
abcdefghijklmno

I don't see the length in the sample output - hex or otherwise. . .

Another cold one, perhaps. . . icon_wink.gif
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: Sat Jun 11, 2011 2:37 am    Post subject:
Reply with quote

Ekta,

Please indicate the RECFM and LRECL of the input file and expected output file.

Show an example of the input records and expected output records in hex
(include the RDW if its VB).
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Sat Jun 11, 2011 4:14 am    Post subject: Re: get length of variable length field
Reply with quote

guptae wrote:
I have a file which contains a variable length string. I want to calculate the length of that field and put it in first 2 bytes (hex value)

Code:
i/p file
xxabcdefghijklmno

o/p
  abcdefghijklmno
when you browse it in hex its actually x'000f' in first two bytes


It seems that if you "code" it, there is something there.

So, input with two bytes waiting to get a length. Text of variable length (how identified, trailing blanks in fixed, length in variable, we don't know).

Output to be two byte binary with length of variable text.

If variable, very easy. xx = (record-lenth-from-RDW (ie start 1, length 2, binary)- 6).

If fixed with trailing blanks, what about embedded blanks? If no, some scan from the front to the first blank. If yes, scan from the length (of the fixed record, I'm sure it must be available) in reverse for first non-blank.

OK, a few dots and crosses remain to be resolved.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Jun 13, 2011 7:21 pm    Post subject:
Reply with quote

Something like this?:
Code:
//VB      EXEC PGM=SORT                 
//SYSOUT  DD   SYSOUT=*                 
//SORTIN  DD   DSN=... VB FILE,DISP=SHR 
//SORTOUT DD   SYSOUT=*                 
//SYSIN   DD    *                       
  OPTION COPY                           
  OUTREC BUILD=(1,4,1,2,BI,C'|',5)       
/*                                       
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 Jun 13, 2011 11:10 pm    Post subject:
Reply with quote

The OP has been asked for various important information such as the RECFM and has not replied. I suggest we refrain from speculating/guessing about the solution until he responds.
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 Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts Move from Comp3 variable to Edited Va... Revathy.nair0485 COBOL Programming 7 Fri Nov 03, 2017 3:30 pm
This topic is locked: you cannot edit posts or make replies. Can a alphanumeric data be moved to a... nico_neoz COBOL Programming 10 Mon Oct 30, 2017 8:28 am
This topic is locked: you cannot edit posts or make replies. Incrementing current time field by 30... arunsoods DFSORT/ICETOOL 11 Thu Oct 26, 2017 3:22 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm

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