> For the complete documentation index, see [llms.txt](https://nviasoft.gitbook.io/nviasoft-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nviasoft.gitbook.io/nviasoft-docs/api-reference/item-parsing/getnextitemformat.md).

# GetNextItemFormat

### int GetNextItemFormat(int lMsgId)

GetNextItemFormat 함수는 SECS 메시지 내의 \*\*현재 읽기 포인터가 가리키고 있는 아이템의 **다음** 데이터 타입(Format)\*\*이 무엇인지 확인하고 싶을 때 사용합니다.

SECS 통신에서는 데이터가 ASCII 문자열인지, 정수(Integer)인지, 혹은 리스트(List)인지에 따라 읽어오는 함수(`GetItem`)가 달라질 수 있으므로, 동적인 메시지 파싱을 위해 사용합니다.

Return Value

<table data-header-hidden><thead><tr><th width="106" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Value</td><td valign="top">Description</td></tr><tr><td valign="top">>=0</td><td valign="top"><p>0 = List</p><p>10 = BINARY,   11 = BOOLEAN,   20 = ASCII,   21 = JIS-8,   30 = INT8,</p><p>31 = INT1,   32 = INT2,   34 = INT4,   40 = FLOAT8,   44 = FLOAT4,</p><p>50 = UINT8,   51 = UINT1,   52 = UINT2,   54 = UINT4</p></td></tr><tr><td valign="top">&#x3C;0</td><td valign="top">더 이상 Next Item이 없음</td></tr></tbody></table>

```csharp
// 1. 다음 아이템의 포맷 확인
    int nFormat = m_gem.GetNextItemFormat(lMsgId);

    if (nFormat < 0)
    {
        Console.WriteLine("더 이상 읽을 데이터가 없습니다.");
        return;
    }

    // 2. 포맷에 따른 분기 처리
    switch (nFormat)
    {
        case 0: // List
            int count = m_gem.GetNextItemCount(lMsgId);
            Console.WriteLine($"리스트 발견: 항목 개수 {count}개");
            break;

        case 20: // ASCII
            string sVal = "";
            m_gem.GetAsciiItem(lMsgId, ref sVal);
            Console.WriteLine("문자열 데이터: " + sVal);
            break;

        case 34: // INT4
            int nVal = 0;
            m_gem.GetI4Item(lMsgId, ref nVal);
            Console.WriteLine("정수형(I4) 데이터: " + nVal);
            break;

        default:
            Console.WriteLine($"기타 포맷 코드 수신: {nFormat}");
            break;
    }
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nviasoft.gitbook.io/nviasoft-docs/api-reference/item-parsing/getnextitemformat.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
