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

Need to insert a value in the file.


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

New User


Joined: 09 Apr 2008
Posts: 41
Location: USA

PostPosted: Tue Oct 21, 2008 10:27 pm
Reply with quote

Hi..

I need to insert a value in the file header, the inserting value should be taken from the file itself.

ForEx:

Input file:

Code:
*******************************
                REPORT


SRNO                       NAME
*******************************
01                         AAAA
02                         BBBB
03                         CCCC
04                         DDDD




Output file:

Code:
*******************************
                REPORT
Count 04

SRNO                       NAME
*******************************
01                         AAAA
02                         BBBB
03                         CCCC
04                         DDDD



_________
Thanks
Balukanna
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 Oct 21, 2008 11:43 pm
Reply with quote

You need to explain more clearly what you're trying to do.

Is the 04 in the Count 04 line the count of data records, or the first field from the last record, or what?

If it's the count of data records, how do we determine where the data records start in the input file? Is it with the 7th record? Or is there some other rule we need to use?
Back to top
View user's profile Send private message
balukanna

New User


Joined: 09 Apr 2008
Posts: 41
Location: USA

PostPosted: Wed Oct 22, 2008 12:06 pm
Reply with quote

Sorry,

The "04" is first field of the last record (position 01 - 02),
it is not the count of records, need to move the value present in the first two position of last record.
Back to top
View user's profile Send private message
balukanna

New User


Joined: 09 Apr 2008
Posts: 41
Location: USA

PostPosted: Wed Oct 22, 2008 1:06 pm
Reply with quote

Very Sorry, missed something in the above reply,

Need the Value of last SRNO field.
In the below Example, in output file the value "04" of SRNO field is to be populated in the header line (i.e count 04)

Input file:

Code:
*******************************
                REPORT


SRNO                       NAME
*******************************
01                         AAAA
02                         BBBB
                           BBBBA
                           BBBBC
03                         CCCC
                           CCCCA                                   
04                         DDDD
                           DDDDA
                           DDDDB




Output file:


Code:
*******************************
                REPORT
Count 04

SRNO                       NAME
*******************************
01                         AAAA
02                         BBBB
                           BBBBA
                           BBBBC
03                         CCCC
                           CCCCA
04                         DDDD
                           DDDDA
                           DDDDB
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Oct 22, 2008 9:07 pm
Reply with quote

balukanna,

The following DFSORT JCL will give you the desired results
Code:

//STEP0100 EXEC PGM=ICEMAN                                 
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD DSN=YOUR INPUT FILE,
//            DISP=SHR                         
//SORTOUT  DD DSN=&&T1,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE) 
//SYSIN    DD *                                             
  INCLUDE COND=(1,2,ZD,EQ,NUM)                             
  SORT FIELDS=COPY                                         
  OUTFIL REMOVECC,NODETAIL,                                 
  TRAILER1=('SRNO,C''',1,2,C'''',80:X)                     
/*                                                         
//STEP0200 EXEC PGM=ICEMAN                                       
//SYSOUT   DD SYSOUT=*                                         
//SYMNAMES DD DSN=&&T1,DISP=SHR                                 
//SORTIN   DD DSN=YOUR INPUT FILE,
//            DISP=SHR   
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                               
  INREC IFOUTLEN=80,IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),
  IFTHEN=(WHEN=(81,8,ZD,EQ,3),OVERLAY=(1:C'COUNT ',SRNO))       
/*                       
Back to top
View user's profile Send private message
balukanna

New User


Joined: 09 Apr 2008
Posts: 41
Location: USA

PostPosted: Wed Oct 22, 2008 11:22 pm
Reply with quote

Hi Skolusu,

I tried the above with a file length of 80, it works fine,
When i tried for a file length 410 it is giving S013 Abend,

i tried to clear the S013 Abend
(The SORTIN, SORTOUT, or OUTFIL BLKSIZE parameter),
but i Can't, please help to clear it.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Oct 23, 2008 1:07 am
Reply with quote

balukanna,

Change your step0200 control cards to the following

Code:

//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                               
  INREC IFOUTLEN=410,IFTHEN=(WHEN=INIT,OVERLAY=(411:SEQNUM,8,ZD)),
  IFTHEN=(WHEN=(411,8,ZD,EQ,3),OVERLAY=(1:C'COUNT ',SRNO))       
/*                                                               
Back to top
View user's profile Send private message
balukanna

New User


Joined: 09 Apr 2008
Posts: 41
Location: USA

PostPosted: Thu Oct 23, 2008 1:02 pm
Reply with quote

Hi Skolusu,

i Have tried the below sort for Record length 410, its giving the same abend (S013), please advise if i given anything wrong in the below one.




Code:
//STEP0100 EXEC PGM=ICEMAN                           
//SYSOUT   DD SYSOUT=*                               
//SORTIN   DD DSN=Input File1
//SORTOUT  DD DSN=Temp File/File2
//SYSIN    DD * 
  INCLUDE COND=(1,2,ZD,EQ,NUM)         
  SORT FIELDS=COPY                     
  OUTFIL REMOVECC,NODETAIL,           
  TRAILER1=('SRNO,C''',1,2,C'''',410:X)
/*                                                   
//STEP0200 EXEC PGM=ICEMAN                           
//SYSOUT   DD SYSOUT=*                               
//SYMNAMES DD DSN=Temp File/File2,DISP=SHR
//SORTIN   DD DSN=Input File1,DISP=SHR
//SORTOUT  DD DSN=Outpt File,DISP=SHR
//SYSIN    DD *                                       
  SORT FIELDS=COPY                                               
  INREC IFOUTLEN=410,IFTHEN=(WHEN=INIT,OVERLAY=(411:SEQNUM,8,ZD)),
  IFTHEN=(WHEN=(411,8,ZD,EQ,3),OVERLAY=(1:C'COUNT ',SRNO))       
/*                                                               
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: Thu Oct 23, 2008 9:09 pm
Reply with quote

Kolusu had:

Code:

  TRAILER1=('SRNO,C''',1,2,C'''',80:X)           


You changed it to:

Code:

  TRAILER1=('SRNO,C''',1,2,C'''',410:X)


Kolusu showed you the change needed in STEP0200. He did NOT tell you to change anything in STEP0100, so why did you change that. You need to change it back to 80:X.
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 FTP VB File from Mainframe retaining ... JCL & VSAM 6
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
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top