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

How to sum 9(5).99 and write it to a file like 9(5).99


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
varalakshmi.G

New User


Joined: 04 Jun 2007
Posts: 55
Location: Hyderabad

PostPosted: Fri Mar 06, 2009 4:15 pm
Reply with quote

Hi,

I have a requirement like:

I have 1 field as 9(5).99 and I want to sum this filed and write this to a file as 9(5).99 means I want '.' also in my output file.

For example:

00123.45
12345.67

means my output file should be 12469.12.

I want this to be done by JCL if it is possible.

I have writtedn the code as

SUM FIELDS=(12,6,ZD)

but getting SOC7 error.

Please advice.

Thank you,

Regards
Lakshmi
Back to top
View user's profile Send private message
varalakshmi.G

New User


Joined: 04 Jun 2007
Posts: 55
Location: Hyderabad

PostPosted: Fri Mar 06, 2009 4:16 pm
Reply with quote

Sorry,By mistake I have posted it in COBOL instead of JCL.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Fri Mar 06, 2009 4:36 pm
Reply with quote

Hi,
varalakshmi.G wrote:
Sorry,By mistake I have posted it in COBOL instead of JCL.
Moved.. icon_smile.gif

At what position in file your data comes? I mean can you show some "actual" records in way as shown below:
Code:
=COLS> ----+----1----+-
****** ****************
000001 00123.45       
000002 12345.67       
****** ****************
and please post complete diagnostic information from the SYSOUT of failed job.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Mar 06, 2009 5:23 pm
Reply with quote

Quote:
I want this to be done by JCL if it is possible
Yes it is possible.

The input data you showed is NOT in ZD format. You can use the SFF/UFF format in SyncSort/DFSORT to achieve this. Post the requested details.
Back to top
View user's profile Send private message
balajiofcrrcoe

New User


Joined: 07 Jul 2005
Posts: 41
Location: chennai

PostPosted: Fri Mar 06, 2009 5:32 pm
Reply with quote

I think the below post helps ur requirement

www.ibmmainframes.com/about25352.html
Back to top
View user's profile Send private message
varalakshmi.G

New User


Joined: 04 Jun 2007
Posts: 55
Location: Hyderabad

PostPosted: Fri Mar 06, 2009 7:41 pm
Reply with quote

Hi,

My file layout is


Code:
***************************** Top
012547771XY200.02300.03400.0410.01
012547772XY200.02300.03400.0420.02
012547772XY200.02300.03400.0430.03


Field starts at 12th position.

I want my output as


Code:
012547771XY200.02300.03400.0410.01
012547772XY400.04600.06800.0850.05


Means if first 11 bytes are same then it should add the remaining fields and write only 1 reocrd.I gave the sort card as below


Code:
//SYSIN DD *                                     
 SORT FIELDS=(1,9,CH,A,10,2,CH,A)                 
 SUM FIELDS=(12,6,ZD,18,6,ZD,24,6,ZD,30,5,ZD)     
/*                                               

SYSOUT has



Code:
 SYNCSORT FOR Z/OS  1.3.0.0R    U.S. PATENTS: 4210961, 5117495   (C) 2007 SYNCSO
                                     A M O C O    C O R P O R A T I O N   z/OS 
 SYNCSORT LICENSED FOR CPU SERIAL NUMBER 5CEB0, MODEL 2096                 LICEN
 SYSIN :                                                                       
  SORT FIELDS=(1,9,CH,A,10,2,CH,A)                                             
  SUM FIELDS=(12,6,ZD,18,6,ZD,24,6,ZD,30,5,ZD)                                 
JOB SUMRFID          STEP SORT            TIME 042401   DATE 09065    ID = 255 
                                                                               
  PSW AT ENTRY TO SNAP    078D1000  80008E66  ILC  02  INTC  0033               
                                                                               
 ASCB: 00F95680                                                                 



Please suggest.

Thanks in advance.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Mar 06, 2009 7:55 pm
Reply with quote

varalakshmi.G wrote:
I gave the sort card as below
Code:
//SYSIN DD *                                     
 SORT FIELDS=(1,9,CH,A,10,2,CH,A)                 
 SUM FIELDS=(12,6,ZD,18,6,ZD,24,6,ZD,30,5,ZD)     
/*                                               
Have you even bothered to look at the manual and see what the SFF/UFF format can do?
Have you even bothered to look at the the link provided?
Back to top
View user's profile Send private message
varalakshmi.G

New User


Joined: 04 Jun 2007
Posts: 55
Location: Hyderabad

PostPosted: Fri Mar 06, 2009 7:58 pm
Reply with quote

I checked that and I am trying that.But one member asked for these details.That is the reason I have given these details.
If it works,I will post the message also.
Thank you.
Back to top
View user's profile Send private message
varalakshmi.G

New User


Joined: 04 Jun 2007
Posts: 55
Location: Hyderabad

PostPosted: Tue Mar 10, 2009 4:40 pm
Reply with quote

Hi,

I gave the SORT card as in the link given by Balaji and it worked.

But I have one doubt.Is it possible to extract the count also.

Means

My input is:

Code:
54771X300.03200.02
54771X200.04333.03
54772Y456.45209.09
Then my output should be

Code:
54771X500.07533.052
54772Y456.45209.091

Here 19th position denotes count.

Please advice.
Thanks
Lakshmi

Edited: Please use BBcode when You post some code/error, that's rather readable, Thanks... Anuj
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Wed Mar 11, 2009 1:03 am
Reply with quote

What should be your expected output if the input is something like this?
Code:
54771X999.99999.99
54771X200.99999.99
54772Y456.45209.09
Back to top
View user's profile Send private message
varalakshmi.G

New User


Joined: 04 Jun 2007
Posts: 55
Location: Hyderabad

PostPosted: Wed Mar 11, 2009 1:38 pm
Reply with quote

My expected output is
Code:
54771X1200.98199.982
54772Y0456.45209.091

Please advice.

Thanks.
Back to top
View user's profile Send private message
varalakshmi.G

New User


Joined: 04 Jun 2007
Posts: 55
Location: Hyderabad

PostPosted: Thu Mar 12, 2009 9:04 pm
Reply with quote

Hi,

Could you please help me in this.

Thanks.
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 0
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
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
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top