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

Convert to Packed decimal and write to Output file


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


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Mar 04, 2009 11:16 pm
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: 496
Location: USA

PostPosted: Thu Mar 05, 2009 3:37 am
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
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: 2481
Location: @my desk

PostPosted: Thu Mar 05, 2009 11:15 am
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
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: 2481
Location: @my desk

PostPosted: Thu Mar 05, 2009 1:52 pm
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
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: 2481
Location: @my desk

PostPosted: Thu Mar 05, 2009 6:17 pm
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
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: 2481
Location: @my desk

PostPosted: Thu Mar 05, 2009 6:53 pm
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: 496
Location: USA

PostPosted: Thu Mar 05, 2009 8:25 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
Search our Forums:

Back to Top