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
 

 

To check for Packed field value

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Shriram Jogdand

New User


Joined: 14 Oct 2008
Posts: 65
Location: Pune

PostPosted: Tue Nov 15, 2011 6:11 pm    Post subject: To check for Packed field value
Reply with quote

Hi,

I am taking unload of IMS database in JCL. Some of the fields are packed fields (Comp-3) and I wanted to unpack those fields. I did this through JCL step.

The problem is that some of the packed fields are having spaces in database ( I dont know how, but there are spaces in IMS packed fields). So when I tried to unpack those fields, the o/p file fields are getting populated with 4040 (i.e. Hex values of Space).

So to overcome this, I wanted to check the input file for spaces in packed fields and overlay the spaces with zeros. I tried below code but it is giving Syntax error

//SYSIN DD *
INREC IFTHEN=(WHEN=(17,6,PD,EQ,C' '),
OVERLAY=(C'000000'))

ERROR:WER253A INCLUDE/OMIT FORMATS INCOMPATIBLE

I guess, the error is coming because I am checking the packed field as character.

Can anybody tell me how to check the input packed field for Spaces values?
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Nov 15, 2011 6:17 pm    Post subject: Re: To check for Packed field value
Reply with quote

Code:
//SYSIN DD *                                       
  INREC IFTHEN=(WHEN=(17,6,CH,EQ,C'     '), 
            OVERLAY=(C'000000'))                   


Try that. But don't. First note the Power of the Code button. Don't let its Power mesmerise you, but use it next time.

The above will get rid of your error message. Your next problem is you are putting character zeros into your packed field. That's not going to work well either.

I also suggest you find out why the fields have space in them, rather than spending all this time worrying about them... you are worried, just because you don't know, aren't you?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Tue Nov 15, 2011 6:29 pm    Post subject: Reply to: To check for Packed field value
Reply with quote

if the data is a packed thing it would be batter to overlay it with the the representation of a packed 0


Code:
 ****** ***************************** Top of Data ******************************
 000001 //ENRICO1  JOB NOTIFY=&SYSUID,                                         
 000002 //             MSGLEVEL=(1,1),CLASS=A,MSGCLASS=H                       
 000003 //*                                                                     
 000004 //ICE     EXEC PGM=SORT                                                 
 000005 //SYSOUT    DD SYSOUT=*                                                 
 000006 //SYSPRINT  DD SYSOUT=*                                                 
 000007 //SORTIN    DD *                                                       
 000008                                                                         
 000009                                                                         
 000010 //SORTOUT   DD SYSOUT=*                                                 
 000011 //SYSIN     DD *                                                       
 000012   OPTION COPY                                                           
 000013   INREC IFTHEN=(WHEN=(1,4,CH,EQ,C'    '),OVERLAY=(1:X'0000000C'))       
 000014 //                                                                     
 ****** **************************** Bottom of Data ****************************


result
Code:
********************************* TOP OF DATA **********************************
                                                                               
                                                                               
 ------------------------------------------------------------------------------
                                                                               
00004444444444444444444444444444444444444444444444444444444444444444444444444444
000C0000000000000000000000000000000000000000000000000000000000000000000000000000
 ------------------------------------------------------------------------------
                                                                               
00004444444444444444444444444444444444444444444444444444444444444444444444444444
000C0000000000000000000000000000000000000000000000000000000000000000000000000000
 ------------------------------------------------------------------------------
******************************** BOTTOM OF DATA ********************************
Back to top
View user's profile Send private message
Shriram Jogdand

New User


Joined: 14 Oct 2008
Posts: 65
Location: Pune

PostPosted: Tue Nov 15, 2011 6:39 pm    Post subject: Reply to: To check for Packed field value
Reply with quote

The problem is that, the database is production database and is managed by some other team.

We are thinkg to check each packed field in program for spaces and move zeros accordingly. But I was checking if we can do that through sort.

Can we somehow over write these input spaces with packed zeros in o/p file?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Tue Nov 15, 2011 6:45 pm    Post subject: Reply to: To check for Packed field value
Reply with quote

Quote:
We are thinkg to check each packed field in program for spaces and move zeros accordingly. But I was checking if we can do that through sort.

Can we somehow over write these input spaces with packed zeros in o/p file?


did You care to read and understand the sample I posted ...
looks like not

it does exactly that... if positions 1 to 4 of the input are spaces it overlays them with the hex representation of a packed 0

no reason for anybody to waste time if You are uncapable of such simple understanding
Back to top
View user's profile Send private message
Shriram Jogdand

New User


Joined: 14 Oct 2008
Posts: 65
Location: Pune

PostPosted: Tue Nov 15, 2011 6:45 pm    Post subject: Reply to: To check for Packed field value
Reply with quote

Thanks Enrico.

Now the problem is that when I tried to unpack this field with the below code, the o/p is coming as '000000-404 '. It should come as '+00000000000'

Code:
INREC IFTHEN=(WHEN=(17,6,CH,EQ,C'      '),             
           OVERLAY=(17:X'0000000C'))                   
SORT FIELDS=COPY                                       
OUTREC FIELDS=(1,16,                                   
               17,6,PD,EDIT=(STTTTTTTTTTT),SIGNS=(+,-))

Can you let me know what I need to change?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Nov 15, 2011 6:45 pm    Post subject: Re: Reply to: To check for Packed field value
Reply with quote

Shriram Jogdand wrote:
[...]

We are thinkg to check each packed field in program for spaces and move zeros accordingly. But I was checking if we can do that through sort.

Can we somehow over write these input spaces with packed zeros in o/p file?


See enrico's code above.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Tue Nov 15, 2011 6:49 pm    Post subject: Reply to: To check for Packed field value
Reply with quote

the only thing to change would Your counting skills icon_cool.gif
.... You check 6 and overlay 4
Code:
   1 2 3 4 5 6
x'00000000000c'


and use the code tags, it makes thins more readable for people willing to help
Back to top
View user's profile Send private message
Shriram Jogdand

New User


Joined: 14 Oct 2008
Posts: 65
Location: Pune

PostPosted: Tue Nov 15, 2011 6:56 pm    Post subject: Reply to: To check for Packed field value
Reply with quote

Thanks ENRICO. icon_biggrin.gif
Back to top
View user's profile Send private message
Shriram Jogdand

New User


Joined: 14 Oct 2008
Posts: 65
Location: Pune

PostPosted: Tue Dec 27, 2011 5:58 pm    Post subject: Reply to: To check for Packed field value
Reply with quote

Hi Enrico,

I am facing some problem here. The thing is that one record can have spaces at many locations in Comp-3 field. So when I am using the below code, it is not checking for the second field if it satisfies the first condition.

INREC IFTHEN=(WHEN=(61,6,CH,EQ,C' '),
OVERLAY=(61:X'00000000000C')),
IFTHEN=(WHEN=(67,6,CH,EQ,C' '),
OVERLAY=(67:X'00000000000C')),
IFTHEN=(WHEN=(80,6,CH,EQ,C' '),
OVERLAY=(80:X'00000000000C')),
IFTHEN=(WHEN=(131,4,CH,EQ,C' '),
OVERLAY=(131:X'0000000C'))

Now, when the record is satisfying the first condition, then it is converting the field at 61 position correctly but it is not checking the second IFTHEN condition which is for 67 position field.

Can you tell how to resolve this issue and convert all the field?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Dec 27, 2011 6:04 pm    Post subject: Reply to: To check for Packed field value
Reply with quote

I don't have SyncSort documentation, but I suspect that including HIT=NEXT in all but the final IFTHEN will get you there. Having satisfied one condition, the default is probably to go on to the next bit of processing, ignoring the other IFTHENs of particular types. Your documentation for SyncSort will make this entirely clear for you.
Back to top
View user's profile Send private message
Shriram Jogdand

New User


Joined: 14 Oct 2008
Posts: 65
Location: Pune

PostPosted: Tue Dec 27, 2011 6:31 pm    Post subject: Reply to: To check for Packed field value
Reply with quote

Thanks Bill. icon_biggrin.gif
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 961
Location: Richmond, Virginia

PostPosted: Tue Dec 27, 2011 6:46 pm    Post subject:
Reply with quote

Forgetting the technical issues - I question your changing blanks (presumably missing data) to zeros (usually a valid value).

Do your specs or other analyses allow that?
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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