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
 

 

Search packed Decimal fields

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Search packed Decimal fields
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Mon Nov 18, 2013 5:52 pm    Post subject: Reply to: search pd fields
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Mon Nov 18, 2013 5:53 pm    Post subject: Reply to: search pd fields
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Nov 18, 2013 6:17 pm    Post subject: Reply to: search pd fields
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    Post subject:
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

Site Director


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

PostPosted: Mon Nov 18, 2013 7:49 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Nov 18, 2013 9:12 pm    Post subject: Reply to: Search pd fields
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

Site Director


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

PostPosted: Mon Nov 18, 2013 9:20 pm    Post subject:
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    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Mon Nov 18, 2013 10:47 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Search a Load Module sreekanth1984 TSO/ISPF 8 Tue Jun 07, 2016 8:45 pm
No new posts Convert Decimal to hexadecimal Steve Ironmonger DFSORT/ICETOOL 5 Fri May 27, 2016 4:19 pm
This topic is locked: you cannot edit posts or make replies. JCL to convert float decimal into rea... polymathtarun JCL & VSAM 3 Sun May 15, 2016 9:57 pm


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