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

how to calculate SUM value for VB file using SORT/ICETOOL JC


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
surezznag

New User


Joined: 04 Aug 2023
Posts: 4
Location: India

PostPosted: Mon Sep 11, 2023 11:41 am
Reply with quote

Hi,

Good day!

I have requirement to find how many records in VB file and Sum for one numeric field (ex: Field name is Amount). VB file has delimiter of pipe '|' between each record.

I can able to calculate count using trailer1 variable like below,

OPTION COPY
OUTFIL NAMES=SORTOUT,REMOVECC,NODETAIL,
TRAILER1=(1:COUNT=(EDIT=IIIIIIIIIT))

For Sum, field position is 5 and since it is VB file and values are not placed in fixed position for each field.
Ex: XXXX|XXXX|XXXX|XXXX|OOOO
where OOOO is amount

Please anyone suggest me how to calculate sum for amount field which is 5th field in VB file.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1255
Location: Bamberg, Germany

PostPosted: Mon Sep 11, 2023 11:43 am
Reply with quote

Code:
OPTION COPY                                                     
INREC PARSE=(%=(ABSPOS=5),                                       
             %=(ENDBEFR=C'|',FIXLEN=8,REPEAT=4),                 
             %01=(ENDBEFR=BLANKS,ENDBEFR=C'|',FIXLEN=8)),       
  OVERLAY=(81:%01)                                               
OUTFIL FNAMES=(SORTOUT),                                         
  REMOVECC,NODETAIL,                                             
  BUILD=(1,4,29:X),                                             
  TRAILER1=(1:COUNT=(M26,LENGTH=10),TOT=(81,8,SFF,M25,LENGTH=15))
END
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts ICETOOL returns no records JCL & VSAM 0
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
Search our Forums:

Back to Top