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

Search packed Decimal fields


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Seppe

New User


Joined: 01 Apr 2009
Posts: 33
Location: Rome - Italy

PostPosted: Mon Nov 18, 2013 5:38 pm
Reply with quote

Hi all,
how can I identify pd fields in a file?
The file has many type of records...
and pd fields are in a different positions.
I need to write a file with a zd number!

Is there a better way than inspect all file?

Thanks.
S.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Mon Nov 18, 2013 5:52 pm
Reply with quote

Is there any binary-data in the file? If not, then this will make things easier, but certainly not simple.

Are you planing on using a COBOL INSPECT?

What you may consider is an INSPECT using the REVERSE FUNCTION using the TALLY Special-Register or a field of your own, initialised to ZERO.

What sign-nibble will be in the packed-decimal data? X'C', X'D' and/or X'F'?

You can see how difficult this would be to isolate packed-decimal data if the file contained binary-data as you'd have a dilemma.

Regards,
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Mon Nov 18, 2013 5:53 pm
Reply with quote

Quote:
how can I identify pd fields in a file?


You cannot identify an arbitrary bit pattern as a PD value
( too many false positives )
would x'000c' be a PD 0 or a binary 12 ?

You can anyway verify if a field matches a PD pattern
0-9 for any half byte a sign for the last half byte.
Back to top
View user's profile Send private message
Seppe

New User


Joined: 01 Apr 2009
Posts: 33
Location: Rome - Italy

PostPosted: Mon Nov 18, 2013 6:10 pm
Reply with quote

Thanks for the reply.

Packed filds are positive and 4 byte long.

I have to find:
x'0000999C' and x'0000001C'
I'm looking for the fields next this packed...
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Nov 18, 2013 6:17 pm
Reply with quote

You can use INSPECT with a hex literal (X'0000001C' for example) but it seems strange that a bit pattern occurring at any of all positions is what you want.
Back to top
View user's profile Send private message
Seppe

New User


Joined: 01 Apr 2009
Posts: 33
Location: Rome - Italy

PostPosted: Mon Nov 18, 2013 6:38 pm
Reply with quote

in fact I'm using an inspect for each fields...
but I was hoping there was a better way...
Thanks all.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Nov 18, 2013 7:49 pm
Reply with quote

Hello,

If the fields are named, simply compare the fields that are packed-decimal against the value(s) you are working with. When you find "the value" in a field, the next field is the one you want (if i understand).

Not sure why an INSPECT is considered . . . icon_confused.gif
Back to top
View user's profile Send private message
Seppe

New User


Joined: 01 Apr 2009
Posts: 33
Location: Rome - Italy

PostPosted: Mon Nov 18, 2013 8:25 pm
Reply with quote

The fields are not named.
I think the inspect command is the only way for solve this problem.

I inspect all rec input and with TALLING i take the number of characters before initial x'0000999C' in variabile x.

by adding 4 to variabile x i have the initial position of the field (K) i'm looking for.

I know K is long 15 characters...

Thanks all.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Nov 18, 2013 8:57 pm
Reply with quote

Quote:
The fields are not named.


does this mean that you do not have a record layout?

if so, i would suggest using sort's SS command.
Back to top
View user's profile Send private message
Seppe

New User


Joined: 01 Apr 2009
Posts: 33
Location: Rome - Italy

PostPosted: Mon Nov 18, 2013 9:04 pm
Reply with quote

Hi dbz.
Exactly, i don't have layout.
I only know in the file input there is a tag in packed form x'0000999c'.
Immediately after there is the field i'm lookiing for. It is 15 char long.

I have already use sort's ss command for take the only record with tag x'000099c' from inital file (approximately 25% of total).
Then i'm sure every record has the tag.

Thanks
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Nov 18, 2013 9:12 pm
Reply with quote

If the field you want is immediately after those PD values, use PARSE with STARTAFT= and the X'0000001C'. FIXLEN=15.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Nov 18, 2013 9:20 pm
Reply with quote

Hello,

I suppose i'm way out in left field, but it does get my attention when there is data in a file and there is no record layout for this file . . . icon_confused.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Nov 18, 2013 9:45 pm
Reply with quote

dick scherrer wrote:
Hello,

I suppose i'm way out in left field, but it does get my attention when there is data in a file and there is no record layout for this file . . . icon_confused.gif


silly situations like this are another reason why the this forum exists.

obviously Seppe has not performed the necessary research to find a layout
of a production file.

the only credible reason for such a requirement as his,
this is a student project.
Back to top
View user's profile Send private message
Seppe

New User


Joined: 01 Apr 2009
Posts: 33
Location: Rome - Italy

PostPosted: Mon Nov 18, 2013 10:26 pm
Reply with quote

not really...

I usually use on-line files for a particular process.
these files are saved for one year.

Today i must recover old data (2010).

I don't have my saved input...
but I have the saved output of a following process (saved for five years) that contains the data i'm looking for.

Certainly exists a layout relatively to the type of records...

But i think this wasn't faster.

dbz as you can see there is another reason...
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Nov 18, 2013 10:47 pm
Reply with quote

Hello,

Going forward, i suggest that any data that is worth keeping for several years has the corresponding record layouts, processing code, and documentation stored until it can All be purged.
Back to top
View user's profile Send private message
Gary McDowell

Active User


Joined: 15 Oct 2012
Posts: 139
Location: USA

PostPosted: Tue Nov 19, 2013 12:21 am
Reply with quote

For no record layout, maybe use Reference Modification.
Possibly make the "from" RM a variable and increment 1 by 1. When found, add 4 to "from" count to get the 15-byte field.

IF input-rec (1:4) = X'0000999C'
MOVE input-rec (5:15) to output.

IF input-rec (ws-var:4) = X'0000999C'
add 4 to ws-var
MOVE input-rec (ws-var:15) to output.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Help required to reset decimal points... DFSORT/ICETOOL 5
No new posts Unable to interpret a hex value to De... COBOL Programming 4
No new posts Pull data using date difference betwe... DB2 6
No new posts small int to zoned decimal conversion DFSORT/ICETOOL 3
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top