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

To check for Packed field value


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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 don't 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

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


Quote:
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

Moderator Emeritus


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

PostPosted: Tue Nov 15, 2011 6:17 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Nov 15, 2011 6:29 pm
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:
 
 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 //                                                                     


result
Code:
             
                                                                               
 ------------------------------------
                                                                               
000044444444444
444444444444444
444444444444444
444444444444444
44444444444444444444
000C0000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
 ----------------------------------
                                                                               
00004444444444444444
44444444444444444444
44444444444444444444
44444444444444444444
000C0000000000000000
000000000000000000000
000000000000000000000
000000000000000000
 -------------------------------------

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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Nov 15, 2011 6:45 pm
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
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

Moderator Emeritus


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

PostPosted: Tue Nov 15, 2011 6:45 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Nov 15, 2011 6:49 pm
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
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
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.

Code:
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

Moderator Emeritus


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

PostPosted: Tue Dec 27, 2011 6:04 pm
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
Reply with quote

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

Senior Member


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

PostPosted: Tue Dec 27, 2011 6:46 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
Search our Forums:

Back to Top