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
 

 

Convert to Packed decimal and write to Output file

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

New User


Joined: 27 Nov 2008
Posts: 37
Location: Cochin

PostPosted: Tue Mar 03, 2009 2:19 pm    Post subject: Convert to Packed decimal and write to Output file
Reply with quote

Hi All,

I have a query. Below are details

I have got an input file (VB format) of record length 1352. Below is the sample record from the file.

TC139002344528 .°..°...................552

From the above record i need to convert value 552 (starting position 53, lenght 3) to packed decimal (PD), based on the sort key value C13900 (starting position 2,length 6)

Note that all other records not matching key i need to directly write to output file with out doing any conversion,

Let me know if its doable. Tips are welcome
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Mar 03, 2009 9:59 pm    Post subject:
Reply with quote

sumueng,

Since your input is a vb file , you need to account for 4 bytes of RDW. Use the following DFSORT control cards

Code:

//SYSIN    DD *                           
  SORT FIELDS=COPY                         
  INREC IFTHEN=(WHEN=(6,6,CH,EQ,C'C13900'),
  OVERLAY=(57:57,3,ZD,PD,LENGTH=3))       
/*
Back to top
View user's profile Send private message
sumueng

New User


Joined: 27 Nov 2008
Posts: 37
Location: Cochin

PostPosted: Wed Mar 04, 2009 3:09 pm    Post subject: Reply to: Convert to Packed decimal and write to Output file
Reply with quote

Thanks for the tip. I will try it out and let know
Back to top
View user's profile Send private message
sumueng

New User


Joined: 27 Nov 2008
Posts: 37
Location: Cochin

PostPosted: Wed Mar 04, 2009 3:41 pm    Post subject: Reply to: Convert to Packed decimal and write to Output file
Reply with quote

Let me know, is it possible to include one more check inside WHEN condition like below

SORT FIELDS=COPY
INREC IFTHEN=(WHEN=((6,6,CH,EQ,C'C13900') AND (17,2,CH,NE,C' '))
OVERLAY=(57:57,4,PD,ZD,LENGTH=4))

When i tried using two different checks i am getting error.

I require mulitple field checks using the above the IF condition. Is it doable
Back to top
View user's profile Send private message
sumueng

New User


Joined: 27 Nov 2008
Posts: 37
Location: Cochin

PostPosted: Wed Mar 04, 2009 4:44 pm    Post subject: Reply to: Convert to Packed decimal and write to Output file
Reply with quote

Hi

I need to change the PD (Packed decimal) values lying in Position 53 and length 3 (since the file is in VB format 53 turns to 57 for RDW) to integer format, using the below sort card i am not getting proper output

//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(6,6,CH,EQ,C'C13900'),
OVERLAY=(57:57,3,ZD,PD,LENGTH=3))
/*

Output:
TC139002344528 .°..°...................55B.

The value requied in the output is 552, but it is showing 55B.
Let me know
Back to top
View user's profile Send private message
sumueng

New User


Joined: 27 Nov 2008
Posts: 37
Location: Cochin

PostPosted: Wed Mar 04, 2009 4:51 pm    Post subject: Reply to: Convert to Packed decimal and write to Output file
Reply with quote

Sorry

the sort card provide in the above post is wrong,

Below is sort card i used to convert packed decimal to Integer format

SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(6,6,CH,EQ,C'C13900'),
OVERLAY=(57:57,3,PD,ZD,LENGTH=3))

The packed decimal starting positon in 53 and lenght 3 (as the file is in VB format 53 turn to 57)

After changing using the above sort the Packed value has now changed to 55B. The required output should be 552.

Let me know
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 Mar 04, 2009 11:16 pm    Post subject:
Reply with quote

Quote:
After changing using the above sort the Packed value has now changed to 55B. The required output should be 552.


That means you're using Syncsort, not DFSORT. DFSORT would give you 552.

Since this is a Syncsort question, I'm moving it to the JCL Forum.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Thu Mar 05, 2009 3:37 am    Post subject: Re: Reply to: Convert to Packed decimal and write to Output
Reply with quote

sumueng wrote:
Code:
OVERLAY=(57:57,3,PD,ZD,LENGTH=3))

After changing using the above sort the Packed value has now changed to 55B. The required output should be 552.

Which release of SyncSort for z/OS are you running?
Back to top
View user's profile Send private message
sumueng

New User


Joined: 27 Nov 2008
Posts: 37
Location: Cochin

PostPosted: Thu Mar 05, 2009 11:04 am    Post subject: Reply to: Convert to Packed decimal and write to Output file
Reply with quote

I am usiing below Syncsort release

SYNCSORT FOR Z/OS 1.3.1.0
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2168
Location: @my desk

PostPosted: Thu Mar 05, 2009 11:15 am    Post subject:
Reply with quote

sumueng,

Change ZD to ZDF
Back to top
View user's profile Send private message
sumueng

New User


Joined: 27 Nov 2008
Posts: 37
Location: Cochin

PostPosted: Thu Mar 05, 2009 11:57 am    Post subject: Reply to: Convert to Packed decimal and write to Output file
Reply with quote

Thanks for Tip boss. It worked well

Now i would like to know is it possible to add another field check using below when condition.

I tried using below way, but received error. let me know

SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(6,6,CH,EQ,C'C13900' AND '17,2,CH,NE,C' '),
OVERLAY=(57:57,3,PD,ZDF,LENGTH=3))
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2168
Location: @my desk

PostPosted: Thu Mar 05, 2009 1:52 pm    Post subject:
Reply with quote

Quote:
but received error
This leaves nothing but guesses. Can you post the SYSOUT messages here.
Back to top
View user's profile Send private message
sumueng

New User


Joined: 27 Nov 2008
Posts: 37
Location: Cochin

PostPosted: Thu Mar 05, 2009 3:27 pm    Post subject: Reply to: Convert to Packed decimal and write to Output file
Reply with quote

When used the following Sort got syntax error with below sysout message

SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(6,6,CH,EQ,C'C13900' AND '17,2,CH,NE,C' '),
OVERLAY=(57:57,3,PD,ZDF,LENGTH=3))


Sysout message:

SYNCSORT LICENSED FOR CPU SERIAL NUMBER 16595, MODEL 2094 506
SYSIN :
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(6,6,CH,EQ,C'C13900' AND '17,2,CH,NE,C' '),
*
OVERLAY=(57:57,3,PD,ZDF,LENGTH=3))
*
WER268A INREC STATEMENT : SYNTAX ERROR
WER275A NO KEYWORDS FOUND ON CONTROL STATEMENT
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2168
Location: @my desk

PostPosted: Thu Mar 05, 2009 6:17 pm    Post subject:
Reply with quote

You MISS a comma (,) before and after the AND keyword and make sure your your control statements start only after the 1st column.
Back to top
View user's profile Send private message
sumueng

New User


Joined: 27 Nov 2008
Posts: 37
Location: Cochin

PostPosted: Thu Mar 05, 2009 6:45 pm    Post subject: Reply to: Convert to Packed decimal and write to Output file
Reply with quote

I am still getting syntax error after inserting comma (,) before and after AND

SYNCSORT LICENSED FOR CPU SERIAL NUMBER 16595, MODEL 2094 506
SYSIN :
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(6,6,CH,EQ,C'C13900',AND,'17,2,CH,NE,C' '),
*
OVERLAY=(57:57,3,PD,ZDF,LENGTH=3))
*

WER268A INREC STATEMENT : SYNTAX ERROR
WER275A NO KEYWORDS FOUND ON CONTROL STATEMENT
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE


Btw which control statements are you refferring boss. i got little confused with your statment.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2168
Location: @my desk

PostPosted: Thu Mar 05, 2009 6:53 pm    Post subject:
Reply with quote

Quote:
Btw which control statements are you refferring boss. i got little confused with your statment
Boss,

The statements which you pass to SyncSort using SYSIN DD * or SYSIN DD DSN= are called control statements. They should start only after pos-1.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Thu Mar 05, 2009 8:25 pm    Post subject: Re: Reply to: Convert to Packed decimal and write to Output
Reply with quote

sumueng wrote:
Code:
                                       
 INREC IFTHEN=(WHEN=(6,6,CH,EQ,C'C13900',AND,'17,2,CH,NE,C'  '),   
 
WER268A  INREC STATEMENT   : SYNTAX ERROR       

You have an extra quote (') after the AND operand. Try this:
Code:
INREC IFTHEN=(WHEN=(6,6,CH,EQ,C'C13900',AND,17,2,CH,NE,C'  '),   
Back to top
View user's profile Send private message
sumueng

New User


Joined: 27 Nov 2008
Posts: 37
Location: Cochin

PostPosted: Fri Mar 06, 2009 10:41 am    Post subject: Reply to: Convert to Packed decimal and write to Output file
Reply with quote

Thanks for the tips. It worked fine now
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 File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Convert +9999999999999.99 to S9(12)V9(3) vnktrrd DFSORT/ICETOOL 8 Thu Nov 17, 2016 8:15 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm


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