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

I have a file in which there is a field called claims


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

New User


Joined: 11 Apr 2006
Posts: 8
Location: Pune

PostPosted: Thu May 18, 2006 1:45 pm
Reply with quote

Hi ,

I have a file in which there is a field called claims and there are other fields. I have to put a comma after each value that occurs in claims feild?
I have to put this comma in all the lines except the last one.eg,

Code:

Claims        name     age
12345,        a        20
56789,        b        23
11991         c        25


hope this summarises the situation. ( this file is crated by fetching the results of a query into a dataset , so i know the no of lines in a file )?
Can somebody throw some light how this can be accomplished in sort or
any other utilities?
Thanks and Regards,
Deepti
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Thu May 18, 2006 2:40 pm
Reply with quote

Hi,

i think this can be easliy done thru OUTREC if claims field is of fix length

eg claims field is of length =6

SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1:1,6,C',',8:7,73)

i dont know exactly how to skip this action for last record .
plz check this out if it helps u .

Thanks ,
-Kapil.
Back to top
View user's profile Send private message
Deepti Bhopatkar

New User


Joined: 11 Apr 2006
Posts: 8
Location: Pune

PostPosted: Thu May 18, 2006 2:55 pm
Reply with quote

Hi ,

Let me modify the query .
1. The addition of comma can be done thru outrec.
2. The omission of last row can be achieved by STOPREC.
However the problem that now i am facing is that it is a productionised job and hence the count ( i.e no of records in the file ) will change daily ?
hence i cant hardcode any value for stoprec in the sortcard nor i can give any symobolic.

Hope this summarises the problem.

Thanks and Regards,
Deepti
Back to top
View user's profile Send private message
rajandhla

Active User


Joined: 18 Oct 2005
Posts: 182
Location: Luton UK

PostPosted: Thu May 18, 2006 3:03 pm
Reply with quote

Is the file contains key on which we can sort
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 May 18, 2006 8:58 pm
Reply with quote

Deepti,

Here's a DFSORT job that will do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//STEP1 EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//S1 DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
* Add seqnum at end of records.
  INREC OVERLAY=(81:SEQNUM,8,ZD)
* T1 has records with seqnums.
  OUTFIL FNAMES=T1
* S1 has a symbol as follows:
* LASTRCD,+n
* where n is the seqnum of the last record.
  OUTFIL FNAMES=S1,REMOVECC,NODETAIL,
    OUTREC=(80X),
    TRAILER1=('LASTRCD,+',81,8)
/*
//STEP2 EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY
* Add a comma for every record except the record
* whose seqnum is LASTRCD.  Remove seqnum.
  INREC IFOUTLEN=80,
    IFTHEN=(WHEN=(81,8,ZD,NE,LASTRCD),
      OVERLAY=(6:C','))
/*
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 1
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