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

convert spreadsheet value to packed decimal


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
faizm

New User


Joined: 13 Apr 2012
Posts: 59
Location: India

PostPosted: Thu Sep 11, 2014 6:22 pm
Reply with quote

Hi,
I am trying to convert the decimal value in excel sheet to S9(9)V9(2) comp-3 by using JCL SORT and below SYSIN
i/p file is LRECL 42, FB
o/p file is LRECL,38,FB
when I transferred this excel to PS file, I can see the values are represented as below
Code:
----+----1----+----2----+----3----+----4--
ABC  JOHNXXXXXXXXX20140911ZB   68.48     
CCC44DDCDEEEEEEEEEFFFFFFFFEC444FF4FF444444
123001685777777777201409119200068B48000000

I am using below sysin
Code:
 
//SYSIN DD *                                 
  SORT FIELDS=COPY                           
  OUTREC FIELDS=(1,31,32,6,ZD,TO=PD,LENGTH=6)
/*               

output coming as
Code:
ABC  JOHNXXXXXXXXX20140911ZB       d±
CCC44DDCDEEEEEEEEEFFFFFFFFEC4440000884
123001685777777777201409119200000064F0


My question: Instead of C in hex value against the value 68.48, why it is coming as 'F' in output record and I think it should be 'C'. Please help what changes in SORT CARD is required to get 'C' in place of 'F'.

Thanks
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Thu Sep 11, 2014 6:55 pm
Reply with quote

C and F are both positive signs, so who cares?
Back to top
View user's profile Send private message
faizm

New User


Joined: 13 Apr 2012
Posts: 59
Location: India

PostPosted: Thu Sep 11, 2014 7:39 pm
Reply with quote

yeah thats correct but when I am trying to match this file with another file that has same record, it doesn't match. HEX value displayed in the second file is shown as
Code:
    dð
0000884
00064C0

Thanks
Back to top
View user's profile Send private message
faizm

New User


Joined: 13 Apr 2012
Posts: 59
Location: India

PostPosted: Thu Sep 11, 2014 7:43 pm
Reply with quote

Apologize, I posted the wrong SYSIN in my first post. I am using the below SYSIN card
Code:
//SYSIN DD *                                 
  SORT FIELDS=COPY                           
  OUTREC FIELDS=(1,31,32,11,UFF,ZD,LENGTH=11)
/*                                           

Thanks
Back to top
View user's profile Send private message
faizm

New User


Joined: 13 Apr 2012
Posts: 59
Location: India

PostPosted: Thu Sep 11, 2014 7:50 pm
Reply with quote

actually got confused, my first post sysin is what I am using i.e
Code:
//SYSIN DD *                                     
  SORT FIELDS=COPY                               
  OUTREC FIELDS=(1,31,32,11,UFF,PD,LENGTH=6,38,1)
/*                                               


Thanks
Back to top
View user's profile Send private message
faizm

New User


Joined: 13 Apr 2012
Posts: 59
Location: India

PostPosted: Fri Sep 12, 2014 11:09 am
Reply with quote

Please help how we can accomplish getting 'C' in place of 'F'. My second file has the amount field defined as S9(9)V9(2) COMP-3. If we can do this through SORT where we can convert the excel value to the signed COMP-3 value? Thanks
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Fri Sep 12, 2014 9:35 pm
Reply with quote

Try below,

Code:
//STEP01   EXEC PGM=SORT                         
//*-----------------------------------------------
//SYSOUT DD SYSOUT=*                             
//SORTIN DD *                                     
68.48                                             
//SORTOUT DD DSN= you.dsn
//SYSIN DD *                                     
    SORT FIELDS=COPY                             
    INREC OVERLAY=(6:1,5,UFF,TO=PD,LENGTH=5)   


Output:

Code:
----+----1-
***********
68.48      dð
FF4FF000884
68B480064C0
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: Sat Sep 13, 2014 3:11 pm
Reply with quote

Faizm,

Would you mind posting the sysout from the step which gives you that result?

Rohit,

There is no substantial difference from what you have posted and what TS/OP has for their control cards. Did you try the original control cards? What did you get?
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Sun Sep 14, 2014 10:44 am
Reply with quote

Off hand and if I'm not missing the obvious - from the SORT card you later posted, if you change ZD to ZDC - you should get a 'C' sign for positive values?
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Mon Sep 15, 2014 8:15 pm
Reply with quote

Bill, I might be doing something wrong for sure, as when I executed his control cards the conversion did not happen and job ran successful.
However, would Inrec Overlay and Outrec Build makes a deffierence to the results? I would double check my card later today.

Anuj, I think, ZDC/ZDF is used to get Zoned Decimals as a output after the conversion and not Vice Versa.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Sep 15, 2014 10:11 pm
Reply with quote

I do not follow you Rohit. My intention is to tell that if OP wants to get 'C' instead of 'F' for positive values - PDC(F) or ZDC(F) should do the trick, assuming everything else is just correct.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Mon Sep 15, 2014 11:26 pm
Reply with quote

Code:
TO=ZDF, TO=ZDC, TO=PDF, TO=PDC

TO=ZDF and TO=ZDC are new output formats you can use in the INREC, OUTREC and OUTFIL statements wherever TO=ZD can be used (converted fields, statistics, page numbers, counts, and so on). With TO=ZDF or TO=ZD, DFSORT uses an F sign for each positive ZD value (for example, +12 = X’F1F2’). With TO=ZDC, DFSORT uses a C sign for each positive ZD value (for example, +12 = X’F1C2’). In either case, DFSORT uses a D sign for each negative ZD value (for example, -12 = X’F1D2’).


TS/OP wants to convert (ZD/ZDF/ZDC/PDF/PDC) TO PD. But your's is true if our target/result format wants to be any of these(ZD/ZDF/ZDC/PDF/PDC).

Hope, I am understanding these sequence correctly.
Back to top
View user's profile Send private message
Gabriel Araujo Alves

New User


Joined: 20 Jul 2010
Posts: 38
Location: Brazil

PostPosted: Tue Sep 16, 2014 7:29 pm
Reply with quote

faizm,

I usually do it this way.

Code:

//SORT01   EXEC PGM=SORT                         
//SYSOUT DD SYSOUT=*                             
//SORTIN DD *                                     
68.48                                             
-68.48                                           
//SORTOUT DD SYSOUT=*                             
//SYSIN DD *                                     
 SORT FIELDS=COPY                                 
 OUTREC FIELDS=((1,6,SFF,MUL,+1),TO=PD,LENGTH=5) 


and the sysout

Code:

00088
0064C
_____
   dý
00088
0064D


Regards.
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: Thu Sep 18, 2014 5:30 am
Reply with quote

I think our shy TS/OP actually has SyncSort. DFSORT will give the C for a positive in a PD. PDC in DFSORT will give an identical result. PDF gives the F for positive.

I think SyncSORT does it differently. PD gives the F and PDC the C for a positive.

TS/OP has got their answer and is long gone.
Back to top
View user's profile Send private message
faizm

New User


Joined: 13 Apr 2012
Posts: 59
Location: India

PostPosted: Thu Sep 18, 2014 6:43 pm
Reply with quote

Hey Bill,
I used PDC and it works icon_smile.gif
Thank you all for giving your valuable inputs.
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Need to convert date format DFSORT/ICETOOL 20
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
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
Search our Forums:

Back to Top