Re: COBOL file dump...
From: Dan Guzman (guzmanda_at_nospam-online.sbcglobal.net)
Date: 09/15/04
- Next message: Louis Davidson: "Re: roll down changes"
- Previous message: MPF: "Re: COBOL file dump..."
- In reply to: MPF: "COBOL file dump..."
- Next in thread: MPF: "Re: COBOL file dump..."
- Reply: MPF: "Re: COBOL file dump..."
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 14 Sep 2004 21:04:57 -0500
The rightmost character includes both the sign and value. Try:
DECLARE @x varchar(11)
SET @x = '0000018922D'
SELECT LEFT(@x, 10) +
CASE RIGHT(@x, 1)
WHEN '{' THEN '0'
WHEN 'A' THEN '1'
WHEN 'B' THEN '2'
WHEN 'C' THEN '3'
WHEN 'D' THEN '4'
WHEN 'E' THEN '5'
WHEN 'F' THEN '6'
WHEN 'G' THEN '7'
WHEN 'H' THEN '8'
WHEN 'I' THEN '9'
WHEN '}' THEN '0-'
WHEN 'J' THEN '1-'
WHEN 'K' THEN '2-'
WHEN 'L' THEN '3-'
WHEN 'M' THEN '4-'
WHEN 'M' THEN '5-'
WHEN 'O' THEN '6-'
WHEN 'P' THEN '7-'
WHEN 'Q' THEN '8-'
WHEN 'R' THEN '9-'
ELSE RIGHT(@x, 1)
END
-- Hope this helps. Dan Guzman SQL Server MVP "MPF" <abcd@senditon.com> wrote in message news:uSZpfurmEHA.2764@TK2MSFTNGP11.phx.gbl... > <similar message posted in .Net Framework & .languages.vb> > > In a file from a COBOL dump, which is in ASCII, one of the fields is > defined > as S9(9) V99 Value +0. > The value in this location is 0000018922D, which according to the author > of > the source, translates to 00000189224. > > I've imported the data into a table and am able to substring (re: > intrepret) everything except for the decimal datatypes, as noted above. Is > there a way to do this via T-SQL? > > Thanks, > > Morgan >
- Next message: Louis Davidson: "Re: roll down changes"
- Previous message: MPF: "Re: COBOL file dump..."
- In reply to: MPF: "COBOL file dump..."
- Next in thread: MPF: "Re: COBOL file dump..."
- Reply: MPF: "Re: COBOL file dump..."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
Loading