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

Counting of char in a fixed length file


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

New User


Joined: 16 Feb 2009
Posts: 54
Location: pune

PostPosted: Tue Feb 17, 2009 11:07 am
Reply with quote

Hi,
I have a requirement of counting the no of line and charters in a file of format FB 315 and putting them in a new file.
Eg

Code:

abc de
fg
hi k


this should give an o/p

Code:

00000000030000000012


i have compleated the no of lines but am stuck for the no of characters,
can any one help me with it .

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN    DD  DSN=input
//SORTOUT  DD DSN=output,
//         DISP=(NEW,CATLG),
//         UNIT=KEEP,RECFM=FB,LRECL=518,
//         SPACE=(CYL,(1000,50),RLSE)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REMOVECC,NODETAIL,
  TRAILER1=(COUNT=(M11,LENGTH=10))
/*



this is wat i have used .
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Tue Feb 17, 2009 1:21 pm
Reply with quote

pema_yozer,

Please check with the below code.
Code:
// EXEC PGM=ICETOOL                         
//DFSMSG DD SYSOUT=*                         
//TOOLMSG DD SYSOUT=*                       
//IN DD DSN=FB315.IN,DISP=SHR       
//T1 DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,1) 
//T2 DD DSN=&&T2,DISP=(,PASS),SPACE=(CYL,1) 
//T3 DD DSN=&&T3,DISP=(,PASS),SPACE=(CYL,1) 
//OUT DD DSN=FB315.OUT,DISP=MOD     
//TOOLIN DD *                               
 COPY FROM(IN) TO(T1) USING(CTL1)           
 COPY FROM(T1) TO(T2) USING(CTL2)           
 COPY FROM(T2) TO(T3) USING(CTL3)           
 COPY FROM(IN) TO(OUT)                       
 COPY FROM(T3) TO(OUT)                       
/*                                           
//CTL1CNTL DD *                             
 OPTION COPY                                 
 OUTFILE REMOVECC,FTOV,VLTRIM=X'40'         
/*                                           
//CTL2CNTL DD *                                                 
 OUTFIL REMOVECC,NODETAIL,                                       
 TRAILER1=(COUNT=(M11,LENGTH=10),TOT=(1,2,BI,M11,LENGTH=10))     
/*                                                               
//CTL3CNTL DD *                                                 
 OUTFIL REMOVECC,VTOF,VLFILL=X'40',                             
 OUTREC=(5,10,15,10,ZD,SUB,(5,10,ZD,MUL,+4),M11,LENGTH=10,315:X)
/*                                                               
//                                                               

FB315.IN:
Code:
abc de
fg   
hi k

FB315.OUT:
Code:
abc de             
fg                 
hi k               
00000000030000000012

Thanks,
Shankar
Back to top
View user's profile Send private message
pema_yozer

New User


Joined: 16 Feb 2009
Posts: 54
Location: pune

PostPosted: Tue Feb 17, 2009 1:26 pm
Reply with quote

hey man thank, just one small modification , i just want
00000000030000000012 in the o/p and could you give me a brief explanation of the code.
Back to top
View user's profile Send private message
pema_yozer

New User


Joined: 16 Feb 2009
Posts: 54
Location: pune

PostPosted: Tue Feb 17, 2009 1:55 pm
Reply with quote

i ran your code but am getting the following error
DFSORT CALL 0001 FOR COPY FROM IN TO T1 USING CTL1CNTL TERMINATED

ICE602I 0 OPERATION RETURN CODE: 16

any idea
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Feb 17, 2009 2:01 pm
Reply with quote

Hi,

you should post all messages, I bet there is also a message
Quote:
ICE056A 9 CTL1OUT NOT DEFINED


I believe you need a later version of DFSORT.


I'm having similar issues.


Gerry
Back to top
View user's profile Send private message
pema_yozer

New User


Joined: 16 Feb 2009
Posts: 54
Location: pune

PostPosted: Tue Feb 17, 2009 2:03 pm
Reply with quote

yup ,thats there too
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: Tue Feb 17, 2009 10:02 pm
Reply with quote

If you don't have z/OS DFSORT V1R5 PTF UK90013 (July, 2008), then you need to specify FNAMES=ddname on the OUTFIL statement where ddname corresponds to the ddname in
TO(ddname). For example:

Code:

  OUTFILE FNAMES=T1,REMOVECC,FTOV,VLTRIM=X'40'


With the PTF, you don't need to specify FNAMES=ddname.
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: Tue Feb 17, 2009 10:19 pm
Reply with quote

pema,

Here's a better way to do what you want with DFSORT:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file (FB/315)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/20)
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
COPY FROM(T1) USING(CTL2)
/*
//CTL1CNTL DD *
  OPTION COPY
  OUTFIL FNAMES=T1,FTOV,VLTRIM=X'40'
/*
//CTL2CNTL DD *
  OPTION COPY
  OUTREC BUILD=(1,4,5:1,2,BI,SUB,+4,TO=ZD,LENGTH=10)
  OUTFIL FNAMES=OUT,REMOVECC,NODETAIL,VTOF,
    BUILD=(20X),
    TRAILER1=(COUNT=(M11,LENGTH=10),TOT=(5,10,ZD,TO=ZD,LENGTH=10))
/*
Back to top
View user's profile Send private message
pema_yozer

New User


Joined: 16 Feb 2009
Posts: 54
Location: pune

PostPosted: Wed Feb 18, 2009 11:52 am
Reply with quote

Thanks, it worked great
Back to top
View user's profile Send private message
pema_yozer

New User


Joined: 16 Feb 2009
Posts: 54
Location: pune

PostPosted: Wed Feb 18, 2009 2:21 pm
Reply with quote

1 more thing can i get the output as

no of line (no of char + line )

abc de
fg
hi k


this should give
00000000030000000015



Thanks Pema
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 Feb 18, 2009 10:26 pm
Reply with quote

Sure. Just change the OUTREC statement to:

Code:

  OUTREC BUILD=(1,4,5:(1,2,BI,SUB,+4),ADD,+1,TO=ZD,LENGTH=10)


That will add 1 to the total for each line.
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top