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
 

 

copying file contents with comp-3 field

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

New User


Joined: 15 Feb 2006
Posts: 32

PostPosted: Mon Apr 17, 2006 9:47 pm    Post subject: copying file contents with comp-3 field
Reply with quote

Hi
I have a problem with a sort. I have a input file (Recl=113 and Rec format = FB ) with a S9(05) comp-3 field (position 11-13) in it.
---------------
input file:
11-13 .......
36222
0
45154
*****
34214
---------------

I need to copy the file contents to a output file with 20000 added to the comp-3 fields ( in position 11-13 ) which don't have zero or low values. When i used the sort card,
i got the following output:
---------------
output file:
11-13 .......
56222
0
65154
60404
54214
---------------

It took the value of "*****" or spaces as "40404" and added 20000 to it. I need the output to be like this:
--------------
output file:
11-13 ........
56222
0
65154
*****
54214
--------------

Kindly help me in this.

Thanks
TG
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 Apr 17, 2006 10:40 pm    Post subject:
Reply with quote

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(11,3,PD,NE,+0,AND,11,3,CH,NE,C' '),
         OVERLAY=(11:11,3,PD,ADD,+20000,TO=PD,LENGTH=3))
/*
Back to top
View user's profile Send private message
tusharguptait

New User


Joined: 15 Feb 2006
Posts: 32

PostPosted: Wed Apr 19, 2006 12:10 am    Post subject: Re: copying file contents with comp-3 field
Reply with quote

Thanks Frank. Does this sort will also deal with low values. That is when the comp-3 field in input file is x'000000' , will 20000 will be added to it? I need not add it to low values.

Thanks
TG
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: Wed Apr 19, 2006 1:08 am    Post subject:
Reply with quote

When you said
Quote:
which don't have zero or low values
I took "zero" to mean PD'0' (X'00000C') and that's what I coded for. If you want to code for binary zeros (X'000000') instead of PD'0', just use 11,3,BI,NE,X'000000' as follows:

Code:

  INREC IFTHEN=(WHEN=(11,3,BI,NE,X'000000',AND,11,3,CH,NE,C' '),
         OVERLAY=(11:11,3,PD,ADD,+20000,TO=PD,LENGTH=3))
Back to top
View user's profile Send private message
tusharguptait

New User


Joined: 15 Feb 2006
Posts: 32

PostPosted: Wed Apr 19, 2006 1:14 pm    Post subject: Re: copying file contents with comp-3 field
Reply with quote

Thanks again Frank. What I had meant was to add the value to fields which don't have zeros, spaces and low values.

I have one question regarding the addition. In the addition process, only digit "2" is having a impact . The addition of rest of the digits of "20000" that is "00000" is useless. Is it possible to add only "2" to the leftmost digit in packed decimal format.

Thanks
TG
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: Wed Apr 19, 2006 8:51 pm    Post subject:
Reply with quote

Quote:
What I had meant was to add the value to fields which don't have zeros, spaces and low values.


zeros as in PD zeros (P'0')? low values as in binary zeros? Did you figure out how to do this based on what I've said previously or do you need me to show you how to do it?

Quote:
I have one question regarding the addition. In the addition process, only digit "2" is having a impact . The addition of rest of the digits of "20000" that is "00000" is useless. Is it possible to add only "2" to the leftmost digit in packed decimal format.


That doesn't make any sense. The addition looks like this:

|12|34|5C|
|20|00|0C|
-------------
|32|34|5C|

These are 3-byte PD values with the sign in the last nibble, so you can add them as PD values. You're asking if you can add just the first nibble - the answer is no because that doesn't represent any valid type of numeric format. But why do you want to do that? What benefit do you think there would be in adding only "2' to the leftmost nibble instead of adding 20000 to the 3-byte PD value?
Back to top
View user's profile Send private message
tusharguptait

New User


Joined: 15 Feb 2006
Posts: 32

PostPosted: Thu Apr 20, 2006 9:38 am    Post subject:
Reply with quote

Quote:
zeros as in PD zeros (P'0')? low values as in binary zeros? Did you figure out how to do this based on what I've said previously or do you need me to show you how to do it??


Frank,
With the help of your input I have figured out the logic to do this. But it seems that I don't have to version of Dfsort to run the sort given by you. When I run the sort I am getting "INVALID INREC OR OUTREC STATEMENT OPERAND" for IFTHEN.And "STATEMENT DEFINER ERROR" for overlay.
ICE000I Message is giving dfsort version as DFSORT REL 14.0.

Quote:

|12|34|5C|
|20|00|0C|
-------------
|32|34|5C|

These are 3-byte PD values with the sign in the last nibble, so you can add them as PD values. You're asking if you can add just the first nibble - the answer is no because that doesn't represent any valid type of numeric format. But why do you want to do that? What benefit do you think there would be in adding only "2' to the leftmost nibble instead of adding 20000 to the 3-byte PD value?


I asked the question because I came to know that I need add "20000" only to comp-3 fields which have values starting with "4" and "3". That is if the field is like "4----c" or "3----c" I should add 20000 to it. The "----" be any value between 0-9 for each digit. In short, apart from zeros,binary zeros and spaces all the values other than "4" or "3" in their first nibble are invalid for addition process.
With the earlier logic I was suggesting I will need back to convert all those comp-3 fields which don't have "6" or "5" ( output file after adding "20000") in their first nibble back to their orginal values .

I am not sure what can be done for this.

Thanks
TG
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: Thu Apr 20, 2006 8:48 pm    Post subject:
Reply with quote

TG,

You need DFSORT R14 PTF UQ95213 to use IFTHEN and OVERLAY. This PTF has been available since Dec, 2004. Ask your System Programmer to install it.

If you just want to add 20000 for values that have X'4----C' or X'3----C',
you can use this control statement (of course, you'll need the Dec, 2004 PTF):

Code:

  INREC IFTHEN=(WHEN=(11,3,BI,EQ,B'0100................1100',OR,
          11,3,BI,EQ,B'0011................1100'),             
         OVERLAY=(11:11,3,PD,ADD,+20000,TO=PD,LENGTH=3))       
Back to top
View user's profile Send private message
tusharguptait

New User


Joined: 15 Feb 2006
Posts: 32

PostPosted: Fri Apr 21, 2006 5:33 pm    Post subject: Re: copying file contents with comp-3 field
Reply with quote

Thanks a lot Frank for your help.

Regards
TG
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 copying data without knowing location arunsoods DFSORT/ICETOOL 6 Thu Jul 20, 2017 1:03 pm
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm


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