Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Counting of char in a fixed length file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
pema_yozer

New User


Joined: 16 Feb 2009
Posts: 45
Location: pune

PostPosted: Tue Feb 17, 2009 11:07 am    Post subject: Counting of char in a fixed length file
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    Post subject:
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: 45
Location: pune

PostPosted: Tue Feb 17, 2009 1:26 pm    Post subject:
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: 45
Location: pune

PostPosted: Tue Feb 17, 2009 1:55 pm    Post subject:
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: 1703
Location: Australia

PostPosted: Tue Feb 17, 2009 2:01 pm    Post subject:
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: 45
Location: pune

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

yup ,thats there too
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Tue Feb 17, 2009 10:02 pm    Post subject:
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 Moderator


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

PostPosted: Tue Feb 17, 2009 10:19 pm    Post subject:
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: 45
Location: pune

PostPosted: Wed Feb 18, 2009 11:52 am    Post subject:
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: 45
Location: pune

PostPosted: Wed Feb 18, 2009 2:21 pm    Post subject:
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 Moderator


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

PostPosted: Wed Feb 18, 2009 10:26 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am
No new posts Occurrence of various strings within ... TS70363 JCL & VSAM 1 Thu Apr 27, 2017 8:18 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us